mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
Remove direct key buffer access in encrypt service test (#14434)
This commit is contained in:
@@ -58,10 +58,9 @@ describe("EncryptService", () => {
|
|||||||
it("fails if type 0 key is provided with flag turned on", async () => {
|
it("fails if type 0 key is provided with flag turned on", async () => {
|
||||||
(encryptService as any).blockType0 = true;
|
(encryptService as any).blockType0 = true;
|
||||||
const mock32Key = mock<SymmetricCryptoKey>();
|
const mock32Key = mock<SymmetricCryptoKey>();
|
||||||
mock32Key.key = makeStaticByteArray(32);
|
|
||||||
mock32Key.inner.mockReturnValue({
|
mock32Key.inner.mockReturnValue({
|
||||||
type: 0,
|
type: 0,
|
||||||
encryptionKey: mock32Key.key,
|
encryptionKey: makeStaticByteArray(32),
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(encryptService.wrapSymmetricKey(mock32Key, mock32Key)).rejects.toThrow(
|
await expect(encryptService.wrapSymmetricKey(mock32Key, mock32Key)).rejects.toThrow(
|
||||||
@@ -99,10 +98,9 @@ describe("EncryptService", () => {
|
|||||||
it("throws if type 0 key is provided with flag turned on", async () => {
|
it("throws if type 0 key is provided with flag turned on", async () => {
|
||||||
(encryptService as any).blockType0 = true;
|
(encryptService as any).blockType0 = true;
|
||||||
const mock32Key = mock<SymmetricCryptoKey>();
|
const mock32Key = mock<SymmetricCryptoKey>();
|
||||||
mock32Key.key = makeStaticByteArray(32);
|
|
||||||
mock32Key.inner.mockReturnValue({
|
mock32Key.inner.mockReturnValue({
|
||||||
type: 0,
|
type: 0,
|
||||||
encryptionKey: mock32Key.key,
|
encryptionKey: makeStaticByteArray(32),
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
@@ -140,10 +138,9 @@ describe("EncryptService", () => {
|
|||||||
it("throws if type 0 key is provided with flag turned on", async () => {
|
it("throws if type 0 key is provided with flag turned on", async () => {
|
||||||
(encryptService as any).blockType0 = true;
|
(encryptService as any).blockType0 = true;
|
||||||
const mock32Key = mock<SymmetricCryptoKey>();
|
const mock32Key = mock<SymmetricCryptoKey>();
|
||||||
mock32Key.key = makeStaticByteArray(32);
|
|
||||||
mock32Key.inner.mockReturnValue({
|
mock32Key.inner.mockReturnValue({
|
||||||
type: 0,
|
type: 0,
|
||||||
encryptionKey: mock32Key.key,
|
encryptionKey: makeStaticByteArray(32),
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
|
|||||||
Reference in New Issue
Block a user