Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

crypto: throw error if chunk decryption fails

Abdullah Attaaa1fa0ca8189
diff --git a/packages/crypto/src/decryption.ts b/packages/crypto/src/decryption.ts
index 15a10659e..b5198c874 100644
--- a/packages/crypto/src/decryption.ts
+++ b/packages/crypto/src/decryption.ts
@@ -98,6 +98,7 @@ export default class Decryption {
chunk,
null
);
+ if (!message) throw new Error("Could not decrypt chunk.");
controller.enqueue(message);
if (tag === crypto_secretstream_xchacha20poly1305_TAG_FINAL)
controller.terminate();