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

[PM-21797] Require userID for keyService's getUserKeyFromStorage (#14855)

* require userID for keyService's getUserKeyFromStorage
This commit is contained in:
Thomas Avery
2025-05-30 13:45:31 -05:00
committed by GitHub
parent 9f9cb0d13d
commit eba22cf5f8
3 changed files with 85 additions and 4 deletions

View File

@@ -178,11 +178,10 @@ export class DefaultKeyService implements KeyServiceAbstraction {
async getUserKeyFromStorage(
keySuffix: KeySuffixOptions,
userId?: UserId,
userId: UserId,
): Promise<UserKey | null> {
userId ??= await firstValueFrom(this.stateProvider.activeUserId$);
if (userId == null) {
throw new Error("No active user id found.");
throw new Error("UserId is required");
}
const userKey = await this.getKeyFromStorage(keySuffix, userId);