From d858823192fbd99c3f55ef75a1b6ec8fa24849c1 Mon Sep 17 00:00:00 2001 From: Jeffrey Holland Date: Thu, 20 Mar 2025 12:22:04 +0100 Subject: [PATCH] Followup to fix merge issues and other comments --- .../app/components/fido2placeholder.component.ts | 4 ++-- .../desktop-fido2-user-interface.service.ts | 4 ++-- .../passkeys/create/fido2-create.component.ts | 15 +++------------ .../src/modal/passkeys/fido2-vault.component.ts | 2 +- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/apps/desktop/src/app/components/fido2placeholder.component.ts b/apps/desktop/src/app/components/fido2placeholder.component.ts index d162e334051..2982b380939 100644 --- a/apps/desktop/src/app/components/fido2placeholder.component.ts +++ b/apps/desktop/src/app/components/fido2placeholder.component.ts @@ -97,7 +97,7 @@ export class Fido2PlaceholderComponent implements OnInit, OnDestroy { // userVerification: true, // }); - this.session.notifyConfirmCredential(true); + this.session.notifyConfirmCreateCredential(true); // Not sure this clean up should happen here or in session. // The session currently toggles modal on and send us here @@ -113,7 +113,7 @@ export class Fido2PlaceholderComponent implements OnInit, OnDestroy { await this.router.navigate(["/"]); await this.desktopSettingsService.setModalMode(false); - this.session.notifyConfirmCredential(false); + this.session.notifyConfirmCreateCredential(false); // little bit hacky: this.session.confirmChosenCipher(null); } 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 337bf0d5ae8..ca9e64559a2 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 @@ -187,7 +187,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi /** * Notifies the Fido2UserInterfaceSession that the UI operations has completed and it can return to the OS. */ - notifyConfirmCredential(confirmed: boolean, updatedCipher?: CipherView): void { + notifyConfirmCreateCredential(confirmed: boolean, updatedCipher?: CipherView): void { if (updatedCipher) { this.updatedCipher = updatedCipher; } @@ -229,7 +229,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi // Wait for the UI to wrap up const confirmation = await this.waitForUiNewCredentialConfirmation(); if (!confirmation) { - throw new Error("User cancelled"); + return { cipherId: undefined, userVerified: false }; } if (this.updatedCipher) { diff --git a/apps/desktop/src/modal/passkeys/create/fido2-create.component.ts b/apps/desktop/src/modal/passkeys/create/fido2-create.component.ts index 98e5f886e67..9a3044296e1 100644 --- a/apps/desktop/src/modal/passkeys/create/fido2-create.component.ts +++ b/apps/desktop/src/modal/passkeys/create/fido2-create.component.ts @@ -94,7 +94,7 @@ export class Fido2CreateComponent implements OnInit { } async addPasskeyToCipher(cipher: CipherView) { - this.session.notifyConfirmCredential(true, cipher); + this.session.notifyConfirmCreateCredential(true, cipher); } async confirmPasskey() { @@ -105,16 +105,7 @@ export class Fido2CreateComponent implements OnInit { throw new Error("No session found"); } - // If we want to we could submit information to the session in order to create the credential - // const cipher = await session.createCredential({ - // userHandle: "userHandle2", - // userName: "username2", - // credentialName: "zxsd2", - // rpId: "webauthn.io", - // userVerification: true, - // }); - - this.session.notifyConfirmCredential(true); + this.session.notifyConfirmCreateCredential(true); // Not sure this clean up should happen here or in session. // The session currently toggles modal on and send us here @@ -129,7 +120,7 @@ export class Fido2CreateComponent implements OnInit { async closeModal() { await this.router.navigate(["/"]); await this.desktopSettingsService.setModalMode(false); - this.session.notifyConfirmCredential(false); + this.session.notifyConfirmCreateCredential(false); this.session.confirmChosenCipher(null); } } diff --git a/apps/desktop/src/modal/passkeys/fido2-vault.component.ts b/apps/desktop/src/modal/passkeys/fido2-vault.component.ts index 787edfb1810..977b61df9b1 100644 --- a/apps/desktop/src/modal/passkeys/fido2-vault.component.ts +++ b/apps/desktop/src/modal/passkeys/fido2-vault.component.ts @@ -96,7 +96,7 @@ export class Fido2VaultComponent implements OnInit, OnDestroy { await this.router.navigate(["/"]); await this.desktopSettingsService.setModalMode(false); - this.session.notifyConfirmCredential(false); + this.session.notifyConfirmCreateCredential(false); this.session.confirmChosenCipher(null); } }