cryptoNode.js 482 B

123456789101112131415
  1. /**
  2. * Internal webcrypto alias.
  3. * We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+.
  4. * Falls back to Node.js built-in crypto for Node.js <=v14.
  5. * See utils.ts for details.
  6. * @module
  7. */
  8. // @ts-ignore
  9. import * as nc from 'node:crypto';
  10. export const crypto = nc && typeof nc === 'object' && 'webcrypto' in nc
  11. ? nc.webcrypto
  12. : nc && typeof nc === 'object' && 'randomBytes' in nc
  13. ? nc
  14. : undefined;
  15. //# sourceMappingURL=cryptoNode.js.map