Skip to content

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

mobile: fix key derivation errors being swallowed

Abdullah Atta6e6226c10562
diff --git a/apps/mobile/app/common/database/encryption.ts b/apps/mobile/app/common/database/encryption.ts
index 5aa065d2b..9a32a3686 100644
--- a/apps/mobile/app/common/database/encryption.ts
+++ b/apps/mobile/app/common/database/encryption.ts
@@ -279,6 +279,8 @@ export async function deriveCryptoKeyFallback(data: SerializedKey) {
MMKV.setMap(USER_KEY_CIPHER, userKeyCipher);
} catch (e) {
DatabaseLogger.error(e);
+ // the caller must know that the master key wasn't changed
+ throw e;
}
}
@@ -306,6 +308,8 @@ export async function deriveCryptoKey(data: SerializedKey) {
MMKV.setMap(USER_KEY_CIPHER, userKeyCipher);
} catch (e) {
DatabaseLogger.error(e);
+ // the caller must know that the master key wasn't changed
+ throw e;
}
}