From fe842b28e31b7530176ca8da49cb520f12fdc979 Mon Sep 17 00:00:00 2001 From: Aviad Pineles Date: Sat, 19 Aug 2023 17:20:54 +0300 Subject: [PATCH] fix possible null value of public key --- app/lib/encryption/encryption.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/lib/encryption/encryption.ts b/app/lib/encryption/encryption.ts index 49cbf8812..05071d074 100644 --- a/app/lib/encryption/encryption.ts +++ b/app/lib/encryption/encryption.ts @@ -203,6 +203,10 @@ class Encryption { // This public key is already encoded using EJSON.stringify in the `persistKeys` method const publicKey = UserPreferences.getString(`${server}-${E2E_PUBLIC_KEY}`); + if (!publicKey) { + throw new Error('Public key not found in local storage, password not changed'); + } + // Send the new keys to the server await Services.e2eSetUserPublicAndPrivateKeys(publicKey, encodedPrivateKey); };