1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-08 20:50:28 +00:00

Fix provider key observable

This commit is contained in:
Bernd Schoolmann
2025-04-25 14:53:17 +02:00
parent 1051e6d9a4
commit ab955d9472

View File

@@ -3,6 +3,7 @@ import {
NEVER,
Observable,
combineLatest,
filter,
firstValueFrom,
forkJoin,
map,
@@ -1019,7 +1020,9 @@ export class DefaultKeyService implements KeyServiceAbstraction {
return combineLatest([
this.stateProvider.getUser(userId, USER_ENCRYPTED_ORGANIZATION_KEYS).state$,
this.providerKeysHelper$(userId, userPrivateKey),
this.providerKeysHelper$(userId, userPrivateKey).pipe(
filter((providerKeys) => providerKeys != null),
),
]).pipe(
switchMap(async ([encryptedOrgKeys, providerKeys]) => {
const result: Record<OrganizationId, OrgKey> = {};
@@ -1036,9 +1039,6 @@ export class DefaultKeyService implements KeyServiceAbstraction {
let decrypted: OrgKey;
if (BaseEncryptedOrganizationKey.isProviderEncrypted(encrypted)) {
if (providerKeys == null) {
throw new Error("No provider keys found.");
}
decrypted = await encrypted.decrypt(this.encryptService, providerKeys);
} else {
decrypted = await encrypted.decrypt(this.encryptService, userPrivateKey);