We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 31a183b commit 512c5f9Copy full SHA for 512c5f9
1 file changed
lib/isomorphic-crypto.ts
@@ -7,14 +7,13 @@ const impl = await (typeof globalThis !== 'undefined' && globalThis.crypto
7
? globalThis.crypto
8
: import('node:crypto'));
9
10
-// we only export SubtleCrypto to make sure the interface remains the same
+// we only export the values we use to keep things simple, we dont need a fully
11
+// cross platform compatible crypto library
12
export const crypto = {
13
getRandomValues: <T extends Uint8Array>(array: T) =>
14
'webcrypto' in impl
15
? impl.webcrypto.getRandomValues(array)
16
: impl.getRandomValues(array),
- CryptoKey:
17
- 'webcrypto' in impl ? impl.webcrypto.CryptoKey : globalThis.CryptoKey,
18
subtle: 'webcrypto' in impl ? impl.webcrypto.subtle : impl.subtle,
19
};
20
0 commit comments