mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-21001] Move vault code to new encrypt service interface (#14546)
* Move vault code to new encrypt service interface * Fix tests
This commit is contained in:
@@ -59,6 +59,7 @@ function setupUserKeyValidation(
|
||||
cipher.key = mockEnc("EncKey");
|
||||
cipherService.getAll.mockResolvedValue([cipher]);
|
||||
encryptService.decryptToBytes.mockResolvedValue(makeStaticByteArray(64));
|
||||
encryptService.decryptString.mockResolvedValue("mockDecryptedString");
|
||||
(window as any).bitwardenContainerService = new ContainerService(keyService, encryptService);
|
||||
}
|
||||
|
||||
@@ -280,6 +281,8 @@ describe("regenerateIfNeeded", () => {
|
||||
setupVerificationResponse(mockVerificationResponse, sdkService);
|
||||
setupUserKeyValidation(cipherService, keyService, encryptService);
|
||||
encryptService.decryptToBytes.mockRejectedValue(new Error("error"));
|
||||
encryptService.decryptString.mockRejectedValue(new Error("error"));
|
||||
encryptService.unwrapSymmetricKey.mockRejectedValue(new Error("error"));
|
||||
|
||||
await sut.regenerateIfNeeded(userId);
|
||||
|
||||
@@ -329,6 +332,8 @@ describe("regenerateIfNeeded", () => {
|
||||
setupVerificationResponse(mockVerificationResponse, sdkService);
|
||||
setupUserKeyValidation(cipherService, keyService, encryptService);
|
||||
encryptService.decryptToBytes.mockRejectedValue(new Error("error"));
|
||||
encryptService.decryptString.mockRejectedValue(new Error("error"));
|
||||
encryptService.unwrapSymmetricKey.mockRejectedValue(new Error("error"));
|
||||
|
||||
await sut.regenerateIfNeeded(userId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user