From 1d2cb826608c3f5807347b50a3b65d923797b8c1 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Wed, 24 Apr 2024 10:12:54 +0100 Subject: [PATCH] fix: mode=strict throws when plaintext in database --- src/encryption.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/encryption.ts b/src/encryption.ts index 8ba0fea..33056a7 100644 --- a/src/encryption.ts +++ b/src/encryption.ts @@ -177,6 +177,9 @@ export function decryptOnRead( }) { try { if (!cloakedStringRegex.test(cipherText)) { + if (fieldConfig.strictDecryption) { + throw new Error('Value is not encrypted and mode=strict') + } return } const decryptionKey = findKeyForMessage(cipherText, keys.keychain)