index : matrix-js-sdk

My fork of matrix-js-sdk

diff options
context:
space:
mode:
authorPeter Cai <[email protected]>2020-06-29 15:50:07 +0800
committerPeter Cai <[email protected]>2020-06-29 15:50:07 +0800
commit4ac4b34979a02e8ba8704658d285e6752b411e59 (patch)
treef96dd1d8b39ba8ad92b32388476772409cb0e973
parentbc5b5876517412668bcf5b406b20cf072837a18c (diff)
downloadmatrix-js-sdk-4ac4b34979a02e8ba8704658d285e6752b411e59.tar.gz
crypto: wrap zerosalt in Buffer
* Somehow, SafeBuffer (used by create-hmac) does not see Uint8Array as valid buffers when concatenating. As a workaround, convert it to buffer every time we need to use it.
-rw-r--r--src/crypto/aes.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crypto/aes.js b/src/crypto/aes.js
index 1556413f..7e8c5a2f 100644
--- a/src/crypto/aes.js
+++ b/src/crypto/aes.js
@@ -99,7 +99,7 @@ async function decryptNode(data, key, name) {
function deriveKeysNode(key, name) {
const crypto = getCrypto();
- const prk = crypto.createHmac("sha256", zerosalt)
+ const prk = crypto.createHmac("sha256", Buffer.from(zerosalt))
.update(key).digest();
const b = Buffer.alloc(1, 1);