mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-24 18:38:15 +01:00
Verify makeAttachmentPointer and encryptAttachment arguments
The underlying `crypto.subtle.encrypt` API requires it.
This commit is contained in:
@@ -87,6 +87,13 @@
|
||||
},
|
||||
|
||||
encryptAttachment: function(plaintext, keys, iv) {
|
||||
if (!(plaintext instanceof ArrayBuffer) && !ArrayBuffer.isView(plaintext)) {
|
||||
throw new TypeError(
|
||||
'`plaintext` must be an `ArrayBuffer` or `ArrayBufferView`; got: ' +
|
||||
typeof plaintext
|
||||
);
|
||||
}
|
||||
|
||||
if (keys.byteLength != 64) {
|
||||
throw new Error("Got invalid length attachment keys");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user