1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

[PM-19172] Passes UserId through change email component and adds tests (#13686)

* add tests and pass userid

* add tests for getOrDeriveMasterKey

* remove extra coalesce for token
This commit is contained in:
Jake Fink
2025-04-01 11:54:13 -04:00
committed by GitHub
parent 575e8b691f
commit a3c9a42d13
4 changed files with 302 additions and 33 deletions

View File

@@ -287,10 +287,15 @@ export class DefaultKeyService implements KeyServiceAbstraction {
),
);
const masterKey = await firstValueFrom(this.masterPasswordService.masterKey$(resolvedUserId));
return (
masterKey ||
(await this.makeMasterKey(password, email, await this.kdfConfigService.getKdfConfig()))
);
if (masterKey != null) {
return masterKey;
}
const kdf = await firstValueFrom(this.kdfConfigService.getKdfConfig$(resolvedUserId));
if (kdf == null) {
throw new Error("No kdf found for user");
}
return await this.makeMasterKey(password, email, kdf);
}
/**