Strip base64 prefix to not have static data in encrypted content
This commit is contained in:
parent
3b8126781d
commit
b24c0ba2f3
|
@ -133,7 +133,7 @@ export default new class E2EE extends BuiltinModule {
|
||||||
try {
|
try {
|
||||||
const decrypt = this.decrypt(this.decrypt(this.decrypt(seed, this.master), haveKey), cached.image);
|
const decrypt = this.decrypt(this.decrypt(this.decrypt(seed, this.master), haveKey), cached.image);
|
||||||
component.props.className = 'bd-decryptedImage';
|
component.props.className = 'bd-decryptedImage';
|
||||||
component.props.src = component.props.original = decrypt;
|
component.props.src = component.props.original = 'data:;base64,' + decrypt;
|
||||||
} catch (err) { return } finally { component.props.readyState = 'READY' }
|
} catch (err) { return } finally { component.props.readyState = 'READY' }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,9 +68,8 @@
|
||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
canvas.height = img.height;
|
canvas.height = img.height;
|
||||||
canvas.width = img.width;
|
canvas.width = img.width;
|
||||||
|
|
||||||
const arrBuffer = await Utils.canvasToArrayBuffer(canvas);
|
const arrBuffer = await Utils.canvasToArrayBuffer(canvas);
|
||||||
const encodedBytes = new TextEncoder().encode(E2EE.encrypt(img.src));
|
const encodedBytes = new TextEncoder().encode(E2EE.encrypt(img.src.replace('data:;base64,', '')));
|
||||||
|
|
||||||
Uploader.upload(DiscordApi.currentChannel.id, FileActions.makeFile(new Uint8Array([...new Uint8Array(arrBuffer), ...encodedBytes]), 'bde2ee.png'));
|
Uploader.upload(DiscordApi.currentChannel.id, FileActions.makeFile(new Uint8Array([...new Uint8Array(arrBuffer), ...encodedBytes]), 'bde2ee.png'));
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue