diff --git a/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts b/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts index 040d4d3c121..fc91f220138 100644 --- a/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts +++ b/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts @@ -676,7 +676,7 @@ export class LoginViaAuthRequestComponent implements OnInit, OnDestroy { private async decryptViaApprovedAuthRequest( authRequestResponse: AuthRequestResponse, - privateKey: ArrayBuffer, + privateKey: Uint8Array, userId: UserId, ): Promise { /** diff --git a/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts b/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts index 1bfbfd8d004..1077bc024e9 100644 --- a/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts +++ b/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts @@ -72,7 +72,7 @@ export abstract class AuthRequestServiceAbstraction { */ abstract setUserKeyAfterDecryptingSharedUserKey( authReqResponse: AuthRequestResponse, - authReqPrivateKey: ArrayBuffer, + authReqPrivateKey: Uint8Array, userId: UserId, ): Promise; /** @@ -83,7 +83,7 @@ export abstract class AuthRequestServiceAbstraction { */ abstract setKeysAfterDecryptingSharedMasterKeyAndHash( authReqResponse: AuthRequestResponse, - authReqPrivateKey: ArrayBuffer, + authReqPrivateKey: Uint8Array, userId: UserId, ): Promise; /** @@ -94,7 +94,7 @@ export abstract class AuthRequestServiceAbstraction { */ abstract decryptPubKeyEncryptedUserKey( pubKeyEncryptedUserKey: string, - privateKey: ArrayBuffer, + privateKey: Uint8Array, ): Promise; /** * Decrypts a `MasterKey` and `MasterKeyHash` from a public key encrypted `MasterKey` and `MasterKeyHash`. @@ -106,7 +106,7 @@ export abstract class AuthRequestServiceAbstraction { abstract decryptPubKeyEncryptedMasterKeyAndHash( pubKeyEncryptedMasterKey: string, pubKeyEncryptedMasterKeyHash: string, - privateKey: ArrayBuffer, + privateKey: Uint8Array, ): Promise<{ masterKey: MasterKey; masterKeyHash: string }>; /** diff --git a/libs/auth/src/common/services/auth-request/auth-request.service.ts b/libs/auth/src/common/services/auth-request/auth-request.service.ts index ba4b9eaf174..89aad0cdbd7 100644 --- a/libs/auth/src/common/services/auth-request/auth-request.service.ts +++ b/libs/auth/src/common/services/auth-request/auth-request.service.ts @@ -213,7 +213,9 @@ export class AuthRequestService implements AuthRequestServiceAbstraction { ); const masterKey = new SymmetricCryptoKey(decryptedMasterKeyArrayBuffer) as MasterKey; - const masterKeyHash = Utils.fromBufferToUtf8(decryptedMasterKeyHashArrayBuffer); + const masterKeyHash = Utils.fromBufferToUtf8( + decryptedMasterKeyHashArrayBuffer.buffer as ArrayBuffer, + ); return { masterKey, diff --git a/libs/common/src/auth/models/domain/admin-auth-req-storable.ts b/libs/common/src/auth/models/domain/admin-auth-req-storable.ts index bdb74ebbc6b..34f1d367ffc 100644 --- a/libs/common/src/auth/models/domain/admin-auth-req-storable.ts +++ b/libs/common/src/auth/models/domain/admin-auth-req-storable.ts @@ -17,7 +17,7 @@ export class AdminAuthRequestStorable { toJSON() { return { id: this.id, - privateKey: Utils.fromBufferToByteString(this.privateKey), + privateKey: Utils.fromBufferToByteString(this.privateKey.buffer as ArrayBuffer), }; } diff --git a/libs/common/src/auth/models/response/two-factor-web-authn.response.ts b/libs/common/src/auth/models/response/two-factor-web-authn.response.ts index 35b6830b0df..d8de2e1247e 100644 --- a/libs/common/src/auth/models/response/two-factor-web-authn.response.ts +++ b/libs/common/src/auth/models/response/two-factor-web-authn.response.ts @@ -41,7 +41,8 @@ export class ChallengeResponse extends BaseResponse implements PublicKeyCredenti super(response); this.attestation = this.getResponseProperty("attestation"); this.authenticatorSelection = this.getResponseProperty("authenticatorSelection"); - this.challenge = Utils.fromUrlB64ToArray(this.getResponseProperty("challenge")); + this.challenge = Utils.fromUrlB64ToArray(this.getResponseProperty("challenge")) + .buffer as ArrayBuffer; this.excludeCredentials = this.getResponseProperty("excludeCredentials").map((c: any) => { c.id = Utils.fromUrlB64ToArray(c.id).buffer; return c;