From a389358988b167f698f67cd186b6e84c5b955cf9 Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:20:31 -0700 Subject: [PATCH] more updates to login-strategy tests --- .../login-strategies/auth-request-login.strategy.spec.ts | 2 +- libs/auth/src/common/login-strategies/login.strategy.spec.ts | 4 ++-- .../src/common/login-strategies/sso-login.strategy.spec.ts | 4 ++-- .../common/login-strategies/user-api-login.strategy.spec.ts | 2 +- .../auth/abstractions/master-password.service.abstraction.ts | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/auth/src/common/login-strategies/auth-request-login.strategy.spec.ts b/libs/auth/src/common/login-strategies/auth-request-login.strategy.spec.ts index a3e2b16a5a..0dc136ffd4 100644 --- a/libs/auth/src/common/login-strategies/auth-request-login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/auth-request-login.strategy.spec.ts @@ -121,7 +121,7 @@ describe("AuthRequestLoginStrategy", () => { const userKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey; masterPasswordService.masterKeySubject.next(masterKey); - masterPasswordService.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); + masterPasswordService.mock.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); await authRequestLoginStrategy.logIn(credentials); diff --git a/libs/auth/src/common/login-strategies/login.strategy.spec.ts b/libs/auth/src/common/login-strategies/login.strategy.spec.ts index 698ae8f054..c24e05101e 100644 --- a/libs/auth/src/common/login-strategies/login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/login.strategy.spec.ts @@ -248,7 +248,7 @@ describe("LoginStrategy", () => { apiService.postIdentityToken.mockResolvedValue(tokenResponse); masterPasswordService.masterKeySubject.next(masterKey); - masterPasswordService.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); + masterPasswordService.mock.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); const result = await passwordLoginStrategy.logIn(credentials); @@ -267,7 +267,7 @@ describe("LoginStrategy", () => { apiService.postIdentityToken.mockResolvedValue(tokenResponse); masterPasswordService.masterKeySubject.next(masterKey); - masterPasswordService.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); + masterPasswordService.mock.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); await passwordLoginStrategy.logIn(credentials); diff --git a/libs/auth/src/common/login-strategies/sso-login.strategy.spec.ts b/libs/auth/src/common/login-strategies/sso-login.strategy.spec.ts index 6679145434..fc03e1dd68 100644 --- a/libs/auth/src/common/login-strategies/sso-login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/sso-login.strategy.spec.ts @@ -435,7 +435,7 @@ describe("SsoLoginStrategy", () => { apiService.postIdentityToken.mockResolvedValue(tokenResponse); masterPasswordService.masterKeySubject.next(masterKey); - masterPasswordService.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); + masterPasswordService.mock.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); await ssoLoginStrategy.logIn(credentials); @@ -486,7 +486,7 @@ describe("SsoLoginStrategy", () => { apiService.postIdentityToken.mockResolvedValue(tokenResponse); masterPasswordService.masterKeySubject.next(masterKey); - masterPasswordService.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); + masterPasswordService.mock.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); await ssoLoginStrategy.logIn(credentials); diff --git a/libs/auth/src/common/login-strategies/user-api-login.strategy.spec.ts b/libs/auth/src/common/login-strategies/user-api-login.strategy.spec.ts index ff56b08831..f365a2d178 100644 --- a/libs/auth/src/common/login-strategies/user-api-login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/user-api-login.strategy.spec.ts @@ -184,7 +184,7 @@ describe("UserApiLoginStrategy", () => { apiService.postIdentityToken.mockResolvedValue(tokenResponse); masterPasswordService.masterKeySubject.next(masterKey); - masterPasswordService.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); + masterPasswordService.mock.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); await apiLogInStrategy.logIn(credentials); diff --git a/libs/common/src/auth/abstractions/master-password.service.abstraction.ts b/libs/common/src/auth/abstractions/master-password.service.abstraction.ts index 0e47edd3ce..4be690c644 100644 --- a/libs/common/src/auth/abstractions/master-password.service.abstraction.ts +++ b/libs/common/src/auth/abstractions/master-password.service.abstraction.ts @@ -87,9 +87,9 @@ export abstract class InternalMasterPasswordServiceAbstraction extends MasterPas * @param userId The desired user * @returns The user key */ - abstract decryptUserKeyWithMasterKey( + abstract decryptUserKeyWithMasterKey: ( masterKey: MasterKey, userKey?: EncString, userId?: string, - ): Promise; + ) => Promise; }