1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Cli: Ask for master password when encryption or decryption fails

This commit is contained in:
Laurent Cozic
2021-11-22 12:46:57 +00:00
parent 0e11273c45
commit c19e59f5da
5 changed files with 52 additions and 23 deletions

View File

@ -340,3 +340,17 @@ export async function masterPasswordIsValid(masterPassword: string, activeMaster
// compare to whatever they've entered earlier.
return Setting.value('encryption.masterPassword') === masterPassword;
}
export async function masterKeysWithoutPassword(): Promise<string[]> {
const syncInfo = localSyncInfo();
const passwordCache = Setting.value('encryption.passwordCache');
const output: string[] = [];
for (const mk of syncInfo.masterKeys) {
if (!masterKeyEnabled(mk)) continue;
const password = await findMasterKeyPassword(EncryptionService.instance(), mk, passwordCache);
if (!password) output.push(mk.id);
}
return output;
}