index : matrix-js-sdk

My fork of matrix-js-sdk

diff options
context:
space:
mode:
authorBruno Windels <[email protected]>2020-06-05 08:30:43 +0000
committerGitHub <[email protected]>2020-06-05 08:30:43 +0000
commit0a790b2ae3341c59b7221fe69298b9096b9c0dc4 (patch)
treef4e6a04b937e2470a461ea8f826765a48f2690e3
parentef1d5e3d765bc4dc133c0637434c2ca9941ff97b (diff)
parentcc8e8434ecc2ab8be7fae9f641d8716b03eb5a67 (diff)
downloadmatrix-js-sdk-0a790b2ae3341c59b7221fe69298b9096b9c0dc4.tar.gz
Merge pull request #1313 from matrix-org/bwindels/throwifcantdecrypt4s
Fix: more informative error message 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 cb21b1c1..ecfa96db 100644
--- a/src/crypto/SecretStorage.js
+++ b/src/crypto/SecretStorage.js
@@ -292,6 +292,11 @@ export class SecretStorage extends EventEmitter {
}
}
+ if (Object.keys(keys).length === 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 {