mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
[EC-271] Refactor CryptoService - move symmetric encryption to EncryptService (#3042)
* move decryptFromBytes, decryptToBytes, and encryptToBytes from CryptoService to EncryptService * leave redirects in CryptoService * combine encryptService decryptFromBytes and decryptToBytes methods * move parsing logic into EncArrayBuffer * add tests
This commit is contained in:
@@ -1,5 +1,27 @@
|
||||
import { webcrypto } from "crypto";
|
||||
|
||||
import { toEqualBuffer } from "./matchers/toEqualBuffer";
|
||||
|
||||
Object.defineProperty(window, "crypto", {
|
||||
value: webcrypto,
|
||||
});
|
||||
|
||||
// Add custom matchers
|
||||
|
||||
expect.extend({
|
||||
toEqualBuffer: toEqualBuffer,
|
||||
});
|
||||
|
||||
interface CustomMatchers<R = unknown> {
|
||||
toEqualBuffer(expected: Uint8Array | ArrayBuffer): R;
|
||||
}
|
||||
|
||||
/* eslint-disable */
|
||||
declare global {
|
||||
namespace jest {
|
||||
interface Expect extends CustomMatchers {}
|
||||
interface Matchers<R> extends CustomMatchers<R> {}
|
||||
interface InverseAsymmetricMatchers extends CustomMatchers {}
|
||||
}
|
||||
}
|
||||
/* eslint-enable */
|
||||
|
||||
Reference in New Issue
Block a user