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

Mobile,Desktop,CLI: Fixes #10856: Decrypt master keys only as needed (#10990)

This commit is contained in:
Henry Heino
2024-09-07 03:56:13 -07:00
committed by GitHub
parent ac2258769a
commit 0bfa28d795
4 changed files with 78 additions and 25 deletions

View File

@ -142,14 +142,10 @@ export async function loadMasterKeysFromSettings(service: EncryptionService) {
const mk = masterKeys[i];
if (service.isMasterKeyLoaded(mk)) continue;
const password = await findMasterKeyPassword(service, mk);
if (!password) continue;
try {
await service.loadMasterKey(mk, password, activeMasterKeyId === mk.id);
} catch (error) {
logger.warn(`Cannot load master key ${mk.id}. Invalid password?`, error);
}
await service.loadMasterKey(mk, async () => {
const password = await findMasterKeyPassword(service, mk);
return password;
}, activeMasterKeyId === mk.id);
}
logger.info(`Loaded master keys: ${service.loadedMasterKeysCount()}`);