From 69d24d29c2b6042cd89b8fd33b2565ffab018c13 Mon Sep 17 00:00:00 2001 From: Jeffrey Holland Date: Wed, 20 Aug 2025 14:01:22 +0200 Subject: [PATCH] Update fido2-vault and fido2-service implementations --- .../credentials/fido2-vault.component.ts | 30 ++++++++++++------- .../desktop-fido2-user-interface.service.ts | 7 +---- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/apps/desktop/src/autofill/modal/credentials/fido2-vault.component.ts b/apps/desktop/src/autofill/modal/credentials/fido2-vault.component.ts index fc582798043..c595f1bbfde 100644 --- a/apps/desktop/src/autofill/modal/credentials/fido2-vault.component.ts +++ b/apps/desktop/src/autofill/modal/credentials/fido2-vault.component.ts @@ -120,16 +120,26 @@ export class Fido2VaultComponent implements OnInit, OnDestroy { return; } - this.cipherIds$.pipe(takeUntil(this.destroy$)).subscribe((cipherIds) => { - this.cipherService - .getAllDecryptedForIds(activeUserId, cipherIds || []) - .then((ciphers) => { - this.ciphersSubject.next(ciphers.filter((cipher) => !cipher.deletedDate)); - }) - .catch((error) => { - this.logService.error("Failed to load ciphers", error); - }); - }); + // Combine cipher list with optional cipher IDs filter + combineLatest([this.cipherService.cipherListViews$(activeUserId), this.cipherIds$ || of(null)]) + .pipe( + map(([ciphers, cipherIds]) => { + // Filter out deleted ciphers + const activeCiphers = ciphers.filter((cipher) => !cipher.deletedDate); + + // If specific IDs provided, filter by them + if (cipherIds?.length > 0) { + return activeCiphers.filter((cipher) => cipherIds.includes(cipher.id)); + } + + return activeCiphers; + }), + takeUntil(this.destroy$), + ) + .subscribe({ + next: (ciphers) => this.ciphersSubject.next(ciphers as CipherView[]), + error: (error: unknown) => this.logService.error("Failed to load ciphers", error), + }); } private async validateCipherAccess(cipher: CipherView): Promise { diff --git a/apps/desktop/src/autofill/services/desktop-fido2-user-interface.service.ts b/apps/desktop/src/autofill/services/desktop-fido2-user-interface.service.ts index 4a4e4c6bf3b..8d4a2bdab68 100644 --- a/apps/desktop/src/autofill/services/desktop-fido2-user-interface.service.ts +++ b/apps/desktop/src/autofill/services/desktop-fido2-user-interface.service.ts @@ -157,12 +157,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi } async getRpId(): Promise { - return lastValueFrom( - this.rpId.pipe( - filter((id) => id != null), - take(1), - ), - ); + return firstValueFrom(this.rpId.pipe(filter((id) => id != null))); } confirmChosenCipher(cipherId: string, userVerified: boolean = false): void {