11cb0ef41Sopenharmony_ci// Copyright Joyent, Inc. and other Node contributors.
21cb0ef41Sopenharmony_ci//
31cb0ef41Sopenharmony_ci// Permission is hereby granted, free of charge, to any person obtaining a
41cb0ef41Sopenharmony_ci// copy of this software and associated documentation files (the
51cb0ef41Sopenharmony_ci// "Software"), to deal in the Software without restriction, including
61cb0ef41Sopenharmony_ci// without limitation the rights to use, copy, modify, merge, publish,
71cb0ef41Sopenharmony_ci// distribute, sublicense, and/or sell copies of the Software, and to permit
81cb0ef41Sopenharmony_ci// persons to whom the Software is furnished to do so, subject to the
91cb0ef41Sopenharmony_ci// following conditions:
101cb0ef41Sopenharmony_ci//
111cb0ef41Sopenharmony_ci// The above copyright notice and this permission notice shall be included
121cb0ef41Sopenharmony_ci// in all copies or substantial portions of the Software.
131cb0ef41Sopenharmony_ci//
141cb0ef41Sopenharmony_ci// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
151cb0ef41Sopenharmony_ci// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
161cb0ef41Sopenharmony_ci// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
171cb0ef41Sopenharmony_ci// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
181cb0ef41Sopenharmony_ci// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
191cb0ef41Sopenharmony_ci// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
201cb0ef41Sopenharmony_ci// USE OR OTHER DEALINGS IN THE SOFTWARE.
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci// Note: In 0.8 and before, crypto functions all defaulted to using
231cb0ef41Sopenharmony_ci// binary-encoded strings rather than buffers.
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci'use strict';
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ciconst {
281cb0ef41Sopenharmony_ci  ObjectDefineProperty,
291cb0ef41Sopenharmony_ci  ObjectDefineProperties,
301cb0ef41Sopenharmony_ci} = primordials;
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ciconst {
331cb0ef41Sopenharmony_ci  assertCrypto,
341cb0ef41Sopenharmony_ci  deprecate,
351cb0ef41Sopenharmony_ci} = require('internal/util');
361cb0ef41Sopenharmony_ciassertCrypto();
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ciconst {
391cb0ef41Sopenharmony_ci  ERR_CRYPTO_FIPS_FORCED,
401cb0ef41Sopenharmony_ci} = require('internal/errors').codes;
411cb0ef41Sopenharmony_ciconst constants = internalBinding('constants').crypto;
421cb0ef41Sopenharmony_ciconst { getOptionValue } = require('internal/options');
431cb0ef41Sopenharmony_ciconst {
441cb0ef41Sopenharmony_ci  getFipsCrypto,
451cb0ef41Sopenharmony_ci  setFipsCrypto,
461cb0ef41Sopenharmony_ci  timingSafeEqual,
471cb0ef41Sopenharmony_ci} = internalBinding('crypto');
481cb0ef41Sopenharmony_ciconst {
491cb0ef41Sopenharmony_ci  checkPrime,
501cb0ef41Sopenharmony_ci  checkPrimeSync,
511cb0ef41Sopenharmony_ci  generatePrime,
521cb0ef41Sopenharmony_ci  generatePrimeSync,
531cb0ef41Sopenharmony_ci  randomBytes,
541cb0ef41Sopenharmony_ci  randomFill,
551cb0ef41Sopenharmony_ci  randomFillSync,
561cb0ef41Sopenharmony_ci  randomInt,
571cb0ef41Sopenharmony_ci  randomUUID,
581cb0ef41Sopenharmony_ci} = require('internal/crypto/random');
591cb0ef41Sopenharmony_ciconst {
601cb0ef41Sopenharmony_ci  pbkdf2,
611cb0ef41Sopenharmony_ci  pbkdf2Sync,
621cb0ef41Sopenharmony_ci} = require('internal/crypto/pbkdf2');
631cb0ef41Sopenharmony_ciconst {
641cb0ef41Sopenharmony_ci  scrypt,
651cb0ef41Sopenharmony_ci  scryptSync,
661cb0ef41Sopenharmony_ci} = require('internal/crypto/scrypt');
671cb0ef41Sopenharmony_ciconst {
681cb0ef41Sopenharmony_ci  hkdf,
691cb0ef41Sopenharmony_ci  hkdfSync,
701cb0ef41Sopenharmony_ci} = require('internal/crypto/hkdf');
711cb0ef41Sopenharmony_ciconst {
721cb0ef41Sopenharmony_ci  generateKeyPair,
731cb0ef41Sopenharmony_ci  generateKeyPairSync,
741cb0ef41Sopenharmony_ci  generateKey,
751cb0ef41Sopenharmony_ci  generateKeySync,
761cb0ef41Sopenharmony_ci} = require('internal/crypto/keygen');
771cb0ef41Sopenharmony_ciconst {
781cb0ef41Sopenharmony_ci  createSecretKey,
791cb0ef41Sopenharmony_ci  createPublicKey,
801cb0ef41Sopenharmony_ci  createPrivateKey,
811cb0ef41Sopenharmony_ci  KeyObject,
821cb0ef41Sopenharmony_ci} = require('internal/crypto/keys');
831cb0ef41Sopenharmony_ciconst {
841cb0ef41Sopenharmony_ci  DiffieHellman,
851cb0ef41Sopenharmony_ci  DiffieHellmanGroup,
861cb0ef41Sopenharmony_ci  ECDH,
871cb0ef41Sopenharmony_ci  diffieHellman,
881cb0ef41Sopenharmony_ci} = require('internal/crypto/diffiehellman');
891cb0ef41Sopenharmony_ciconst {
901cb0ef41Sopenharmony_ci  Cipher,
911cb0ef41Sopenharmony_ci  Cipheriv,
921cb0ef41Sopenharmony_ci  Decipher,
931cb0ef41Sopenharmony_ci  Decipheriv,
941cb0ef41Sopenharmony_ci  privateDecrypt,
951cb0ef41Sopenharmony_ci  privateEncrypt,
961cb0ef41Sopenharmony_ci  publicDecrypt,
971cb0ef41Sopenharmony_ci  publicEncrypt,
981cb0ef41Sopenharmony_ci  getCipherInfo,
991cb0ef41Sopenharmony_ci} = require('internal/crypto/cipher');
1001cb0ef41Sopenharmony_ciconst {
1011cb0ef41Sopenharmony_ci  Sign,
1021cb0ef41Sopenharmony_ci  signOneShot,
1031cb0ef41Sopenharmony_ci  Verify,
1041cb0ef41Sopenharmony_ci  verifyOneShot,
1051cb0ef41Sopenharmony_ci} = require('internal/crypto/sig');
1061cb0ef41Sopenharmony_ciconst {
1071cb0ef41Sopenharmony_ci  Hash,
1081cb0ef41Sopenharmony_ci  Hmac,
1091cb0ef41Sopenharmony_ci} = require('internal/crypto/hash');
1101cb0ef41Sopenharmony_ciconst {
1111cb0ef41Sopenharmony_ci  X509Certificate,
1121cb0ef41Sopenharmony_ci} = require('internal/crypto/x509');
1131cb0ef41Sopenharmony_ciconst {
1141cb0ef41Sopenharmony_ci  getCiphers,
1151cb0ef41Sopenharmony_ci  getCurves,
1161cb0ef41Sopenharmony_ci  getDefaultEncoding,
1171cb0ef41Sopenharmony_ci  getHashes,
1181cb0ef41Sopenharmony_ci  setDefaultEncoding,
1191cb0ef41Sopenharmony_ci  setEngine,
1201cb0ef41Sopenharmony_ci  secureHeapUsed,
1211cb0ef41Sopenharmony_ci} = require('internal/crypto/util');
1221cb0ef41Sopenharmony_ciconst Certificate = require('internal/crypto/certificate');
1231cb0ef41Sopenharmony_ci
1241cb0ef41Sopenharmony_cilet webcrypto;
1251cb0ef41Sopenharmony_cifunction lazyWebCrypto() {
1261cb0ef41Sopenharmony_ci  webcrypto ??= require('internal/crypto/webcrypto');
1271cb0ef41Sopenharmony_ci  return webcrypto;
1281cb0ef41Sopenharmony_ci}
1291cb0ef41Sopenharmony_ci
1301cb0ef41Sopenharmony_ci// These helper functions are needed because the constructors can
1311cb0ef41Sopenharmony_ci// use new, in which case V8 cannot inline the recursive constructor call
1321cb0ef41Sopenharmony_cifunction createHash(algorithm, options) {
1331cb0ef41Sopenharmony_ci  return new Hash(algorithm, options);
1341cb0ef41Sopenharmony_ci}
1351cb0ef41Sopenharmony_ci
1361cb0ef41Sopenharmony_cifunction createCipher(cipher, password, options) {
1371cb0ef41Sopenharmony_ci  return new Cipher(cipher, password, options);
1381cb0ef41Sopenharmony_ci}
1391cb0ef41Sopenharmony_ci
1401cb0ef41Sopenharmony_cifunction createCipheriv(cipher, key, iv, options) {
1411cb0ef41Sopenharmony_ci  return new Cipheriv(cipher, key, iv, options);
1421cb0ef41Sopenharmony_ci}
1431cb0ef41Sopenharmony_ci
1441cb0ef41Sopenharmony_cifunction createDecipher(cipher, password, options) {
1451cb0ef41Sopenharmony_ci  return new Decipher(cipher, password, options);
1461cb0ef41Sopenharmony_ci}
1471cb0ef41Sopenharmony_ci
1481cb0ef41Sopenharmony_cifunction createDecipheriv(cipher, key, iv, options) {
1491cb0ef41Sopenharmony_ci  return new Decipheriv(cipher, key, iv, options);
1501cb0ef41Sopenharmony_ci}
1511cb0ef41Sopenharmony_ci
1521cb0ef41Sopenharmony_cifunction createDiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {
1531cb0ef41Sopenharmony_ci  return new DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding);
1541cb0ef41Sopenharmony_ci}
1551cb0ef41Sopenharmony_ci
1561cb0ef41Sopenharmony_cifunction createDiffieHellmanGroup(name) {
1571cb0ef41Sopenharmony_ci  return new DiffieHellmanGroup(name);
1581cb0ef41Sopenharmony_ci}
1591cb0ef41Sopenharmony_ci
1601cb0ef41Sopenharmony_cifunction createECDH(curve) {
1611cb0ef41Sopenharmony_ci  return new ECDH(curve);
1621cb0ef41Sopenharmony_ci}
1631cb0ef41Sopenharmony_ci
1641cb0ef41Sopenharmony_cifunction createHmac(hmac, key, options) {
1651cb0ef41Sopenharmony_ci  return new Hmac(hmac, key, options);
1661cb0ef41Sopenharmony_ci}
1671cb0ef41Sopenharmony_ci
1681cb0ef41Sopenharmony_cifunction createSign(algorithm, options) {
1691cb0ef41Sopenharmony_ci  return new Sign(algorithm, options);
1701cb0ef41Sopenharmony_ci}
1711cb0ef41Sopenharmony_ci
1721cb0ef41Sopenharmony_cifunction createVerify(algorithm, options) {
1731cb0ef41Sopenharmony_ci  return new Verify(algorithm, options);
1741cb0ef41Sopenharmony_ci}
1751cb0ef41Sopenharmony_ci
1761cb0ef41Sopenharmony_cimodule.exports = {
1771cb0ef41Sopenharmony_ci  // Methods
1781cb0ef41Sopenharmony_ci  checkPrime,
1791cb0ef41Sopenharmony_ci  checkPrimeSync,
1801cb0ef41Sopenharmony_ci  createCipheriv,
1811cb0ef41Sopenharmony_ci  createDecipheriv,
1821cb0ef41Sopenharmony_ci  createDiffieHellman,
1831cb0ef41Sopenharmony_ci  createDiffieHellmanGroup,
1841cb0ef41Sopenharmony_ci  createECDH,
1851cb0ef41Sopenharmony_ci  createHash,
1861cb0ef41Sopenharmony_ci  createHmac,
1871cb0ef41Sopenharmony_ci  createPrivateKey,
1881cb0ef41Sopenharmony_ci  createPublicKey,
1891cb0ef41Sopenharmony_ci  createSecretKey,
1901cb0ef41Sopenharmony_ci  createSign,
1911cb0ef41Sopenharmony_ci  createVerify,
1921cb0ef41Sopenharmony_ci  diffieHellman,
1931cb0ef41Sopenharmony_ci  generatePrime,
1941cb0ef41Sopenharmony_ci  generatePrimeSync,
1951cb0ef41Sopenharmony_ci  getCiphers,
1961cb0ef41Sopenharmony_ci  getCipherInfo,
1971cb0ef41Sopenharmony_ci  getCurves,
1981cb0ef41Sopenharmony_ci  getDiffieHellman: createDiffieHellmanGroup,
1991cb0ef41Sopenharmony_ci  getHashes,
2001cb0ef41Sopenharmony_ci  hkdf,
2011cb0ef41Sopenharmony_ci  hkdfSync,
2021cb0ef41Sopenharmony_ci  pbkdf2,
2031cb0ef41Sopenharmony_ci  pbkdf2Sync,
2041cb0ef41Sopenharmony_ci  generateKeyPair,
2051cb0ef41Sopenharmony_ci  generateKeyPairSync,
2061cb0ef41Sopenharmony_ci  generateKey,
2071cb0ef41Sopenharmony_ci  generateKeySync,
2081cb0ef41Sopenharmony_ci  privateDecrypt,
2091cb0ef41Sopenharmony_ci  privateEncrypt,
2101cb0ef41Sopenharmony_ci  publicDecrypt,
2111cb0ef41Sopenharmony_ci  publicEncrypt,
2121cb0ef41Sopenharmony_ci  randomBytes,
2131cb0ef41Sopenharmony_ci  randomFill,
2141cb0ef41Sopenharmony_ci  randomFillSync,
2151cb0ef41Sopenharmony_ci  randomInt,
2161cb0ef41Sopenharmony_ci  randomUUID,
2171cb0ef41Sopenharmony_ci  scrypt,
2181cb0ef41Sopenharmony_ci  scryptSync,
2191cb0ef41Sopenharmony_ci  sign: signOneShot,
2201cb0ef41Sopenharmony_ci  setEngine,
2211cb0ef41Sopenharmony_ci  timingSafeEqual,
2221cb0ef41Sopenharmony_ci  getFips,
2231cb0ef41Sopenharmony_ci  setFips,
2241cb0ef41Sopenharmony_ci  verify: verifyOneShot,
2251cb0ef41Sopenharmony_ci
2261cb0ef41Sopenharmony_ci  // Classes
2271cb0ef41Sopenharmony_ci  Certificate,
2281cb0ef41Sopenharmony_ci  Cipher,
2291cb0ef41Sopenharmony_ci  Cipheriv,
2301cb0ef41Sopenharmony_ci  Decipher,
2311cb0ef41Sopenharmony_ci  Decipheriv,
2321cb0ef41Sopenharmony_ci  DiffieHellman,
2331cb0ef41Sopenharmony_ci  DiffieHellmanGroup,
2341cb0ef41Sopenharmony_ci  ECDH,
2351cb0ef41Sopenharmony_ci  Hash,
2361cb0ef41Sopenharmony_ci  Hmac,
2371cb0ef41Sopenharmony_ci  KeyObject,
2381cb0ef41Sopenharmony_ci  Sign,
2391cb0ef41Sopenharmony_ci  Verify,
2401cb0ef41Sopenharmony_ci  X509Certificate,
2411cb0ef41Sopenharmony_ci  secureHeapUsed,
2421cb0ef41Sopenharmony_ci};
2431cb0ef41Sopenharmony_ci
2441cb0ef41Sopenharmony_cifunction getFips() {
2451cb0ef41Sopenharmony_ci  return getOptionValue('--force-fips') ? 1 : getFipsCrypto();
2461cb0ef41Sopenharmony_ci}
2471cb0ef41Sopenharmony_ci
2481cb0ef41Sopenharmony_cifunction setFips(val) {
2491cb0ef41Sopenharmony_ci  if (getOptionValue('--force-fips')) {
2501cb0ef41Sopenharmony_ci    if (val) return;
2511cb0ef41Sopenharmony_ci    throw new ERR_CRYPTO_FIPS_FORCED();
2521cb0ef41Sopenharmony_ci  } else {
2531cb0ef41Sopenharmony_ci    setFipsCrypto(val);
2541cb0ef41Sopenharmony_ci  }
2551cb0ef41Sopenharmony_ci}
2561cb0ef41Sopenharmony_ci
2571cb0ef41Sopenharmony_cifunction getRandomValues(array) {
2581cb0ef41Sopenharmony_ci  return lazyWebCrypto().crypto.getRandomValues(array);
2591cb0ef41Sopenharmony_ci}
2601cb0ef41Sopenharmony_ci
2611cb0ef41Sopenharmony_ciObjectDefineProperty(constants, 'defaultCipherList', {
2621cb0ef41Sopenharmony_ci  __proto__: null,
2631cb0ef41Sopenharmony_ci  get() {
2641cb0ef41Sopenharmony_ci    const value = getOptionValue('--tls-cipher-list');
2651cb0ef41Sopenharmony_ci    ObjectDefineProperty(this, 'defaultCipherList', {
2661cb0ef41Sopenharmony_ci      __proto__: null,
2671cb0ef41Sopenharmony_ci      writable: true,
2681cb0ef41Sopenharmony_ci      configurable: true,
2691cb0ef41Sopenharmony_ci      enumerable: true,
2701cb0ef41Sopenharmony_ci      value,
2711cb0ef41Sopenharmony_ci    });
2721cb0ef41Sopenharmony_ci    return value;
2731cb0ef41Sopenharmony_ci  },
2741cb0ef41Sopenharmony_ci  set(val) {
2751cb0ef41Sopenharmony_ci    ObjectDefineProperty(this, 'defaultCipherList', {
2761cb0ef41Sopenharmony_ci      __proto__: null,
2771cb0ef41Sopenharmony_ci      writable: true,
2781cb0ef41Sopenharmony_ci      configurable: true,
2791cb0ef41Sopenharmony_ci      enumerable: true,
2801cb0ef41Sopenharmony_ci      value: val,
2811cb0ef41Sopenharmony_ci    });
2821cb0ef41Sopenharmony_ci  },
2831cb0ef41Sopenharmony_ci  configurable: true,
2841cb0ef41Sopenharmony_ci  enumerable: true,
2851cb0ef41Sopenharmony_ci});
2861cb0ef41Sopenharmony_ci
2871cb0ef41Sopenharmony_cifunction getRandomBytesAlias(key) {
2881cb0ef41Sopenharmony_ci  return {
2891cb0ef41Sopenharmony_ci    enumerable: false,
2901cb0ef41Sopenharmony_ci    configurable: true,
2911cb0ef41Sopenharmony_ci    get() {
2921cb0ef41Sopenharmony_ci      let value;
2931cb0ef41Sopenharmony_ci      if (getOptionValue('--pending-deprecation')) {
2941cb0ef41Sopenharmony_ci        value = deprecate(
2951cb0ef41Sopenharmony_ci          randomBytes,
2961cb0ef41Sopenharmony_ci          `crypto.${key} is deprecated.`,
2971cb0ef41Sopenharmony_ci          'DEP0115');
2981cb0ef41Sopenharmony_ci      } else {
2991cb0ef41Sopenharmony_ci        value = randomBytes;
3001cb0ef41Sopenharmony_ci      }
3011cb0ef41Sopenharmony_ci      ObjectDefineProperty(
3021cb0ef41Sopenharmony_ci        this,
3031cb0ef41Sopenharmony_ci        key,
3041cb0ef41Sopenharmony_ci        {
3051cb0ef41Sopenharmony_ci          __proto__: null,
3061cb0ef41Sopenharmony_ci          enumerable: false,
3071cb0ef41Sopenharmony_ci          configurable: true,
3081cb0ef41Sopenharmony_ci          writable: true,
3091cb0ef41Sopenharmony_ci          value: value,
3101cb0ef41Sopenharmony_ci        },
3111cb0ef41Sopenharmony_ci      );
3121cb0ef41Sopenharmony_ci      return value;
3131cb0ef41Sopenharmony_ci    },
3141cb0ef41Sopenharmony_ci    set(value) {
3151cb0ef41Sopenharmony_ci      ObjectDefineProperty(
3161cb0ef41Sopenharmony_ci        this,
3171cb0ef41Sopenharmony_ci        key,
3181cb0ef41Sopenharmony_ci        {
3191cb0ef41Sopenharmony_ci          __proto__: null,
3201cb0ef41Sopenharmony_ci          enumerable: true,
3211cb0ef41Sopenharmony_ci          configurable: true,
3221cb0ef41Sopenharmony_ci          writable: true,
3231cb0ef41Sopenharmony_ci          value,
3241cb0ef41Sopenharmony_ci        },
3251cb0ef41Sopenharmony_ci      );
3261cb0ef41Sopenharmony_ci    },
3271cb0ef41Sopenharmony_ci  };
3281cb0ef41Sopenharmony_ci}
3291cb0ef41Sopenharmony_ci
3301cb0ef41Sopenharmony_ciObjectDefineProperties(module.exports, {
3311cb0ef41Sopenharmony_ci  createCipher: {
3321cb0ef41Sopenharmony_ci    __proto__: null,
3331cb0ef41Sopenharmony_ci    enumerable: false,
3341cb0ef41Sopenharmony_ci    value: deprecate(createCipher,
3351cb0ef41Sopenharmony_ci                     'crypto.createCipher is deprecated.', 'DEP0106'),
3361cb0ef41Sopenharmony_ci  },
3371cb0ef41Sopenharmony_ci  createDecipher: {
3381cb0ef41Sopenharmony_ci    __proto__: null,
3391cb0ef41Sopenharmony_ci    enumerable: false,
3401cb0ef41Sopenharmony_ci    value: deprecate(createDecipher,
3411cb0ef41Sopenharmony_ci                     'crypto.createDecipher is deprecated.', 'DEP0106'),
3421cb0ef41Sopenharmony_ci  },
3431cb0ef41Sopenharmony_ci  // crypto.fips is deprecated. DEP0093. Use crypto.getFips()/crypto.setFips()
3441cb0ef41Sopenharmony_ci  fips: {
3451cb0ef41Sopenharmony_ci    __proto__: null,
3461cb0ef41Sopenharmony_ci    get: getFips,
3471cb0ef41Sopenharmony_ci    set: setFips,
3481cb0ef41Sopenharmony_ci  },
3491cb0ef41Sopenharmony_ci  DEFAULT_ENCODING: {
3501cb0ef41Sopenharmony_ci    __proto__: null,
3511cb0ef41Sopenharmony_ci    enumerable: false,
3521cb0ef41Sopenharmony_ci    configurable: true,
3531cb0ef41Sopenharmony_ci    get: deprecate(getDefaultEncoding,
3541cb0ef41Sopenharmony_ci                   'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091'),
3551cb0ef41Sopenharmony_ci    set: deprecate(setDefaultEncoding,
3561cb0ef41Sopenharmony_ci                   'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091'),
3571cb0ef41Sopenharmony_ci  },
3581cb0ef41Sopenharmony_ci  constants: {
3591cb0ef41Sopenharmony_ci    __proto__: null,
3601cb0ef41Sopenharmony_ci    configurable: false,
3611cb0ef41Sopenharmony_ci    enumerable: true,
3621cb0ef41Sopenharmony_ci    value: constants,
3631cb0ef41Sopenharmony_ci  },
3641cb0ef41Sopenharmony_ci
3651cb0ef41Sopenharmony_ci  webcrypto: {
3661cb0ef41Sopenharmony_ci    __proto__: null,
3671cb0ef41Sopenharmony_ci    configurable: false,
3681cb0ef41Sopenharmony_ci    enumerable: true,
3691cb0ef41Sopenharmony_ci    get() { return lazyWebCrypto().crypto; },
3701cb0ef41Sopenharmony_ci    set: undefined,
3711cb0ef41Sopenharmony_ci  },
3721cb0ef41Sopenharmony_ci
3731cb0ef41Sopenharmony_ci  subtle: {
3741cb0ef41Sopenharmony_ci    __proto__: null,
3751cb0ef41Sopenharmony_ci    configurable: false,
3761cb0ef41Sopenharmony_ci    enumerable: true,
3771cb0ef41Sopenharmony_ci    get() { return lazyWebCrypto().crypto.subtle; },
3781cb0ef41Sopenharmony_ci    set: undefined,
3791cb0ef41Sopenharmony_ci  },
3801cb0ef41Sopenharmony_ci
3811cb0ef41Sopenharmony_ci  getRandomValues: {
3821cb0ef41Sopenharmony_ci    __proto__: null,
3831cb0ef41Sopenharmony_ci    configurable: false,
3841cb0ef41Sopenharmony_ci    enumerable: true,
3851cb0ef41Sopenharmony_ci    get: () => getRandomValues,
3861cb0ef41Sopenharmony_ci    set: undefined,
3871cb0ef41Sopenharmony_ci  },
3881cb0ef41Sopenharmony_ci
3891cb0ef41Sopenharmony_ci  // Aliases for randomBytes are deprecated.
3901cb0ef41Sopenharmony_ci  // The ecosystem needs those to exist for backwards compatibility.
3911cb0ef41Sopenharmony_ci  prng: getRandomBytesAlias('prng'),
3921cb0ef41Sopenharmony_ci  pseudoRandomBytes: getRandomBytesAlias('pseudoRandomBytes'),
3931cb0ef41Sopenharmony_ci  rng: getRandomBytesAlias('rng'),
3941cb0ef41Sopenharmony_ci});
395