mirror of
https://github.com/bitwarden/browser
synced 2024-12-16 19:30:28 +01:00
c90eb42ead
* 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 */
|