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 {
1212 utf8ToBytes
1313} from "@noble/hashes/utils" ;
1414
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+
1520// buf.toString('utf8') -> bytesToUtf8(buf)
1621export function bytesToUtf8 ( data : Uint8Array ) : string {
1722 if ( ! ( data instanceof Uint8Array ) ) {
@@ -46,9 +51,10 @@ export function wrapHash(hash: (msg: Uint8Array) => Uint8Array) {
4651 } ;
4752}
4853
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 } = ( ( ) => {
5056 const webCrypto =
51- typeof self === "object" && "crypto" in self ? self . crypto : undefined ;
57+ typeof globalThis === "object" && "crypto" in globalThis ? globalThis . crypto : undefined ;
5258 const nodeRequire =
5359 typeof module !== "undefined" &&
5460 typeof module . require === "function" &&
You can’t perform that action at this time.
0 commit comments