mirror of
https://github.com/bitwarden/browser.git
synced 2024-09-12 01:48:21 +02:00
* 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
28 lines
590 B
TypeScript
28 lines
590 B
TypeScript
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 */
|