node:crypto

Node's crypto module, with the algorithms and APIs Elide leaves out.

node:crypto provides Node’s hashing, cipher, key, signature, key-agreement, derivation, and random APIs. Key generation includes ML-DSA and ML-KEM; webcrypto is the same object as globalThis.crypto.

Differences from Node

  • process.versions.openssl is 1.1.1 and process.features.openssl_is_boringssl is true.
  • Errors use BoringSSL-style strings (error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT) and ERR_OSSL_* codes.

Not available

  • X509Certificate and Certificate are not exported.
  • Ed448 and X448 throw ERR_CRYPTO_UNSUPPORTED_OPERATION; OCB ciphers are absent.
  • argon2 and argon2Sync throw ERR_CRYPTO_ARGON2_NOT_SUPPORTED.
  • setFips throws ERR_CRYPTO_FIPS_UNAVAILABLE; getFips() returns 0.
  • setEngine throws ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED.