File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,11 @@ export {
12
12
utf8ToBytes
13
13
} from "@noble/hashes/utils" ;
14
14
15
+ // Global symbols in both browsers and Node.js since v11
16
+ // See https://github.com/microsoft/TypeScript/issues/31535
17
+ declare const TextEncoder : any ;
18
+ declare const TextDecoder : any ;
19
+
15
20
// buf.toString('utf8') -> bytesToUtf8(buf)
16
21
export function bytesToUtf8 ( data : Uint8Array ) : string {
17
22
if ( ! ( data instanceof Uint8Array ) ) {
@@ -46,9 +51,10 @@ export function wrapHash(hash: (msg: Uint8Array) => Uint8Array) {
46
51
} ;
47
52
}
48
53
49
- export const crypto : { node ?: any ; web ?: Crypto } = ( ( ) => {
54
+ // TODO(v3): switch away from node crypto, remove this unnecessary variable.
55
+ export const crypto : { node ?: any ; web ?: any } = ( ( ) => {
50
56
const webCrypto =
51
- typeof self === "object" && "crypto" in self ? self . crypto : undefined ;
57
+ typeof globalThis === "object" && "crypto" in globalThis ? globalThis . crypto : undefined ;
52
58
const nodeRequire =
53
59
typeof module !== "undefined" &&
54
60
typeof module . require === "function" &&
You can’t perform that action at this time.
0 commit comments