index : matrix-js-sdk

My fork of matrix-js-sdk

diff options
context:
space:
mode:
authorBruno Windels <[email protected]>2020-04-09 16:00:08 +0200
committerBruno Windels <[email protected]>2020-04-09 16:00:08 +0200
commit1b94b3c4def3e06e9ad260e6d0fad2f6261971f0 (patch)
tree74902ca3f0bd375f770af1728f05e9c63afa0ef1
parent84637c6ebd442346623bce562b441e1093d40270 (diff)
downloadmatrix-js-sdk-1b94b3c4def3e06e9ad260e6d0fad2f6261971f0.tar.gz
throw something more informative when we cant find a key to decrypt with
-rw-r--r--src/crypto/SecretStorage.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/crypto/SecretStorage.js b/src/crypto/SecretStorage.js
index 123fecf4..fc4420d3 100644
--- a/src/crypto/SecretStorage.js
+++ b/src/crypto/SecretStorage.js
@@ -363,6 +363,11 @@ export class SecretStorage extends EventEmitter {
}
}
+ if (Object.keys(keys) === 0) {
+ throw new Error(`Could not decrypt ${name} because none of ` +
+ `the keys it is encrypted with are for a supported algorithm`);
+ }
+
let keyId;
let decryption;
try {