1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

Update DeviceTrustService

This commit is contained in:
Justin Baur
2024-05-24 16:40:50 -04:00
parent 4f526bf1b7
commit 363d71c1ac
2 changed files with 5 additions and 3 deletions

View File

@@ -175,7 +175,7 @@ export class DeviceTrustService implements DeviceTrustServiceAbstraction {
}
// At this point of rotating their keys, they should still have their old user key in state
const oldUserKey = await firstValueFrom(this.cryptoService.activeUserKey$);
const oldUserKey = await firstValueFrom(this.cryptoService.userKey$(userId));
const deviceIdentifier = await this.appIdService.getAppId();
const secretVerificationRequest = new SecretVerificationRequest();

View File

@@ -595,7 +595,7 @@ describe("deviceTrustService", () => {
const fakeNewUserKeyData = new Uint8Array(64);
fakeNewUserKeyData.fill(FakeNewUserKeyMarker, 0, 1);
fakeNewUserKey = new SymmetricCryptoKey(fakeNewUserKeyData) as UserKey;
cryptoService.activeUserKey$ = of(fakeNewUserKey);
cryptoService.userKey$.mockReturnValue(of(fakeNewUserKey));
});
it("throws an error when a null user id is passed in", async () => {
@@ -631,7 +631,9 @@ describe("deviceTrustService", () => {
fakeOldUserKeyData.fill(FakeOldUserKeyMarker, 0, 1);
// Mock the retrieval of a user key that differs from the new one passed into the method
cryptoService.activeUserKey$ = of(new SymmetricCryptoKey(fakeOldUserKeyData) as UserKey);
cryptoService.userKey$.mockReturnValue(
of(new SymmetricCryptoKey(fakeOldUserKeyData) as UserKey),
);
appIdService.getAppId.mockResolvedValue("test_device_identifier");