You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	All: When resetting the master password, also create a new master key with that password
This commit is contained in:
		| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user