1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

Auth/PM-5099 Ensure consistent casing of email used for fingerprint generation in Auth Requests (#8571)

* Created method for handilng email-address-based fingerprint.

* Added test for new method.

* Added returns to annotation
This commit is contained in:
Todd Martin
2024-09-04 10:22:06 -04:00
committed by GitHub
parent b90563aa50
commit 86fab07a37
5 changed files with 36 additions and 9 deletions

View File

@@ -27,6 +27,7 @@ describe("AuthRequestService", () => {
const apiService = mock<ApiService>();
let mockPrivateKey: Uint8Array;
let mockPublicKey: Uint8Array;
const mockUserId = Utils.newGuid() as UserId;
beforeEach(() => {
@@ -44,6 +45,7 @@ describe("AuthRequestService", () => {
);
mockPrivateKey = new Uint8Array(64);
mockPublicKey = new Uint8Array(64);
});
describe("authRequestPushNotification$", () => {
@@ -262,4 +264,14 @@ describe("AuthRequestService", () => {
expect(result.masterKeyHash).toEqual(mockDecryptedMasterKeyHash);
});
});
describe("getFingerprintPhrase", () => {
it("returns the same fingerprint regardless of email casing", () => {
const email = "test@email.com";
const emailUpperCase = email.toUpperCase();
const phrase = sut.getFingerprintPhrase(email, mockPublicKey);
const phraseUpperCase = sut.getFingerprintPhrase(emailUpperCase, mockPublicKey);
expect(phrase).toEqual(phraseUpperCase);
});
});
});