1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

[PM-7604] Require target UserID for KdfConfigService (#14380)

* Require userId for KdfConfigService

* Update auth team callers

* Update tools team callers
This commit is contained in:
Thomas Avery
2025-04-29 17:25:27 -05:00
committed by GitHub
parent f39e37002b
commit d43e4757df
14 changed files with 171 additions and 142 deletions

View File

@@ -37,14 +37,14 @@ export class DefaultKdfConfigService implements KdfConfigService {
await this.stateProvider.setUserState(KDF_CONFIG, kdfConfig, userId);
}
async getKdfConfig(): Promise<KdfConfig> {
const userId = await firstValueFrom(this.stateProvider.activeUserId$);
async getKdfConfig(userId: UserId): Promise<KdfConfig> {
if (userId == null) {
throw new Error("KdfConfig can only be retrieved when there is active user");
throw new Error("userId cannot be null");
}
const state = await firstValueFrom(this.stateProvider.getUser(userId, KDF_CONFIG).state$);
if (state == null) {
throw new Error("KdfConfig for active user account state is null");
throw new Error("KdfConfig for user " + userId + " is null");
}
return state;
}