From 7ba4672aa0472263c5451a81d712be191b216f04 Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Wed, 29 Oct 2025 14:07:25 -0700 Subject: [PATCH] update authRequestId param requirement and add clarifying comment to desktop --- .../extension-auth-request-answering.service.ts | 2 +- .../desktop-auth-request-answering.service.ts | 8 +++++++- .../auth-request-answering.service.abstraction.ts | 4 ++-- .../default-auth-request-answering.service.ts | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/browser/src/auth/services/auth-request-answering/extension-auth-request-answering.service.ts b/apps/browser/src/auth/services/auth-request-answering/extension-auth-request-answering.service.ts index 4d07ab3c767..21b5e61057f 100644 --- a/apps/browser/src/auth/services/auth-request-answering/extension-auth-request-answering.service.ts +++ b/apps/browser/src/auth/services/auth-request-answering/extension-auth-request-answering.service.ts @@ -42,7 +42,7 @@ export class ExtensionAuthRequestAnsweringService ); } - override async receivedPendingAuthRequest(userId: UserId, authRequestId?: string): Promise { + override async receivedPendingAuthRequest(userId: UserId, authRequestId: string): Promise { if (!authRequestId) { throw new Error("authRequestId not found."); } diff --git a/apps/desktop/src/auth/services/auth-request-answering/desktop-auth-request-answering.service.ts b/apps/desktop/src/auth/services/auth-request-answering/desktop-auth-request-answering.service.ts index 87ed5d33b77..fe36e59dd1a 100644 --- a/apps/desktop/src/auth/services/auth-request-answering/desktop-auth-request-answering.service.ts +++ b/apps/desktop/src/auth/services/auth-request-answering/desktop-auth-request-answering.service.ts @@ -32,7 +32,13 @@ export class DesktopAuthRequestAnsweringService ); } - override async receivedPendingAuthRequest(userId: UserId): Promise { + /** + * @param userId + * @param _ placeholder for the authRequestId param, which is not used on Desktop because clicks + * on a Desktop notification do not run any auth-request-specific actions. All clicks + * simply open the Desktop window. See electron-main-messaging.service.ts. + */ + override async receivedPendingAuthRequest(userId: UserId, _: string): Promise { // Always persist the pending marker for this user to global state. await this.pendingAuthRequestsState.add(userId); diff --git a/libs/common/src/auth/abstractions/auth-request-answering/auth-request-answering.service.abstraction.ts b/libs/common/src/auth/abstractions/auth-request-answering/auth-request-answering.service.abstraction.ts index 04db1efa27b..2253dc22076 100644 --- a/libs/common/src/auth/abstractions/auth-request-answering/auth-request-answering.service.abstraction.ts +++ b/libs/common/src/auth/abstractions/auth-request-answering/auth-request-answering.service.abstraction.ts @@ -10,12 +10,12 @@ export abstract class AuthRequestAnsweringService { * so that even if someone closes a window or a popup and comes back, it could be processed later. * Only way to clear out the global state is to respond to the auth request. * - * Currently, this is only implemented for browser extension. + * Currently implemented on Extension and Desktop. * * @param userId The UserId that the auth request is for. * @param authRequestId The id of the auth request that is to be processed. */ - abstract receivedPendingAuthRequest(userId: UserId, authRequestId?: string): Promise; + abstract receivedPendingAuthRequest(userId: UserId, authRequestId: string): Promise; /** * Confirms whether or not the user meets the conditions required to show an approval diff --git a/libs/common/src/auth/services/auth-request-answering/default-auth-request-answering.service.ts b/libs/common/src/auth/services/auth-request-answering/default-auth-request-answering.service.ts index aadbcd179ca..992e1952d0e 100644 --- a/libs/common/src/auth/services/auth-request-answering/default-auth-request-answering.service.ts +++ b/libs/common/src/auth/services/auth-request-answering/default-auth-request-answering.service.ts @@ -38,7 +38,7 @@ export class DefaultAuthRequestAnsweringService implements AuthRequestAnsweringS protected readonly pendingAuthRequestsState: PendingAuthRequestsStateService, ) {} - async receivedPendingAuthRequest(userId: UserId): Promise { + async receivedPendingAuthRequest(userId: UserId, authRequestId: string): Promise { throw new Error("receivedPendingAuthRequest() not implemented for this client"); } @@ -51,7 +51,7 @@ export class DefaultAuthRequestAnsweringService implements AuthRequestAnsweringS this.masterPasswordService.forceSetPasswordReason$(userId), ); - // Use must be unlocked, active, and must not be required to set/change their master password + // User must be unlocked, active, and must not be required to set/change their master password const meetsConditions = authStatus === AuthenticationStatus.Unlocked && activeUserId === userId &&