Files
scriptc/internal/compatibility
Chris Tate fc229822e7 Support X25519 keys and crypto.diffieHellman
X25519 KeyObjects come from generateKeyPair(Sync)("x25519"), which keeps
the private key clamped as OpenSSL does, and from createPrivateKey and
createPublicKey of PKCS#8, SubjectPublicKeyInfo, JWK (OKP, X25519) and
raw keys. They export in the same forms. sign, verify, createSign and
createVerify throw OpenSSL's "operation not supported for this keytype",
with its library, reason and code properties. X25519 uses mbedTLS's
Curve25519 group.

crypto.diffieHellman({ privateKey, publicKey }[, callback]) computes the
X25519 and ECDH secrets of two keys of one type, given as KeyObjects or
in any form createPrivateKey and createPublicKey read. The checks run in
Node's order: the options, the callback, both keys present, the key types
when both are KeyObjects ("Incompatible key types for Diffie-Hellman"),
then the public and private key inputs. Mismatched curves, a small-order
X25519 point and key types other than EC and X25519 throw OpenSSL's
errors. The callback form passes the secret, or the error without the
OpenSSL properties, in a later macrotask, as Node's DHBitsJob does.

createPublicKey also reads a private key's DER encodings (pkcs8 and
sec1), which Node accepts there.
2026-10-23 15:56:08 -05:00
..
2026-10-22 04:08:52 -05:00
2026-10-14 17:27:02 -05:00

Node compatibility ledger

This workspace package owns scriptc's Node.js parity system.

  • node-v24.json pins the Node release tag, commit, and canonical docs/source inputs.
  • static-support.json overlays dedicated compiler paths and their internal test evidence on the compiler's generated surface manifest.
  • generated/node-v24-internal.json is the engineering ledger, including implementation evidence and repository test paths.
  • pnpm node-compat:backlog derives the internal tier-specific work queue from the ledger; it is not committed. It separates verification, implementation, explicit-refusal replacement, and partial-surface audit work, and prioritizes stable Node APIs above experimental, deprecated, and legacy APIs.
  • docs/src/generated/node-v24-compatibility.json is the stripped public artifact consumed by the docs website. It contains compiler-relevant runtime APIs, statuses, verification bases, and user-facing details; documentation, metadata, command-line/configuration entries, and rows that are N/A for native execution remain internal.

Statuses are evidence-aware: supported and partial require test evidence; refused requires an explicit compiler diagnostic or native throwing stub; not-implemented is the actionable backlog for an owned API family with no implementation match; by-design records an architectural exclusion; unreviewed still needs classification; and not-applicable is not a runtime API for that execution tier.

Run pnpm node-compat:backlog from the repository root for a summary. The filters --tier, --action, --priority, --chapter, and --status compose; use --format=json or --format=tsv for tooling.

Run pnpm node-compat from the repository root after changing the Node pin or the support manifest. pnpm node-compat --local does the same without network access while the pin is unchanged, by reclassifying the committed ledger rows; after a merge, node scripts/regen-generated.mjs regenerates every generated file instead of a hand merge. pnpm node-compat:check is the offline drift/evidence gate; pnpm --filter @internal/compatibility check:upstream additionally verifies the pinned upstream inputs over the network.

npm packages that compile as builtins

The ledger counts Node APIs, so npm packages that compile as a Node builtin have no rows. packages/compiler/src/frontend/builtin-package-aliases.ts lists them, each with the checked major versions and the reason its module is that builtin on Node 24. One entry is a documented divergence rather than an identity: readable-stream 2.x, 3.x and 4.x compile as node:stream; for 2.x and 4.x that is the package's READABLE_STREAM=disable behavior. Without that variable Node runs the package's own JavaScript streams. The tests/corpus/readable-stream-disable program pins the disabled behavior. 3.x, a copy of Node 10's streams, cannot run disabled on Node 24 (its disable branch throws), so tests/corpus/readable-stream-3 pins only behavior its own streams share with the builtin.