-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathjest.setup.js
More file actions
28 lines (22 loc) · 798 Bytes
/
Copy pathjest.setup.js
File metadata and controls
28 lines (22 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { TextEncoder, TextDecoder } from "node:util";
import { webcrypto } from "node:crypto";
import { Blob, File } from "node:buffer";
if (!globalThis.TextEncoder) globalThis.TextEncoder = TextEncoder;
if (!globalThis.TextDecoder) globalThis.TextDecoder = TextDecoder;
try {
Object.defineProperty(globalThis, "crypto", {
value: webcrypto,
writable: true,
configurable: true,
});
} catch (e) {
globalThis.crypto = webcrypto;
}
if (!globalThis.CryptoKey && webcrypto && webcrypto.CryptoKey) {
globalThis.CryptoKey = webcrypto.CryptoKey;
}
if (!globalThis.Blob) globalThis.Blob = Blob;
if (!globalThis.File) globalThis.File = File;
import { WebCryptPQC } from "./src/WebCryptPQC.js";
// Enable PQC stub testing in unit test environment
WebCryptPQC.enableStubTesting(true);