mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
All: When resetting the master password, also create a new master key with that password
This commit is contained in:
parent
577aa519e0
commit
e647775608
@ -145,6 +145,11 @@ describe('e2ee/utils', () => {
|
||||
expect(localSyncInfo().ppk.id).not.toBe(previousPpk.id);
|
||||
expect(localSyncInfo().ppk.privateKey.ciphertext).not.toBe(previousPpk.privateKey.ciphertext);
|
||||
expect(localSyncInfo().ppk.publicKey).not.toBe(previousPpk.publicKey);
|
||||
|
||||
// Also check that a new master key has been created, that it is active and enabled
|
||||
expect(localSyncInfo().masterKeys.length).toBe(3);
|
||||
expect(localSyncInfo().activeMasterKeyId).toBe(localSyncInfo().masterKeys[2].id);
|
||||
expect(masterKeyEnabled(localSyncInfo().masterKeys[2])).toBe(true);
|
||||
});
|
||||
|
||||
it('should fix active key selection issues - 1', async () => {
|
||||
|
@ -311,6 +311,10 @@ export async function resetMasterPassword(encryptionService: EncryptionService,
|
||||
}
|
||||
|
||||
Setting.setValue('encryption.masterPassword', newPassword);
|
||||
|
||||
const masterKey = await encryptionService.generateMasterKey(newPassword);
|
||||
await MasterKey.save(masterKey);
|
||||
await loadMasterKeysFromSettings(encryptionService);
|
||||
}
|
||||
|
||||
export enum MasterPasswordStatus {
|
||||
|
Loading…
Reference in New Issue
Block a user