cryptoNode.ts 324 B

1234567
  1. // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
  2. // See utils.ts for details.
  3. // The file will throw on node.js 14 and earlier.
  4. // @ts-ignore
  5. import * as nc from 'node:crypto';
  6. export const crypto =
  7. nc && typeof nc === 'object' && 'webcrypto' in nc ? (nc.webcrypto as any) : undefined;