Summary
Node exposes crypto.DiffieHellman and crypto.DiffieHellmanGroup as enumerable callable constructor exports. Perry has createDiffieHellman, createDiffieHellmanGroup, and getDiffieHellman factory coverage and DH handle support, but the class constructor exports themselves are missing from the manifest/declarations.
This is a narrower export-shape gap than expanding DH algorithm behavior.
Node behavior
On local Node v25.9.0:
const crypto = require("node:crypto");
Object.keys(crypto).includes("DiffieHellman"); // true
Object.keys(crypto).includes("DiffieHellmanGroup"); // true
typeof crypto.DiffieHellman; // "function"
crypto.DiffieHellman.length; // 4
typeof crypto.DiffieHellmanGroup; // "function"
crypto.DiffieHellmanGroup.length; // 1
new crypto.DiffieHellman(512).generateKeys; // function
crypto.DiffieHellman(512).computeSecret; // function
new crypto.DiffieHellmanGroup("modp5").getPrime; // function
crypto.DiffieHellmanGroup("modp5").generateKeys; // function
Both constructors are callable with and without new.
Current Perry evidence
Current origin/main has factory/handle coverage but not the constructor exports:
crates/perry-api-manifest/src/entries.rs registers crypto.createDiffieHellman, crypto.createDiffieHellmanGroup, and crypto.getDiffieHellman, but no class("crypto", "DiffieHellman"), class("crypto", "DiffieHellmanGroup"), or callable method entries for those constructor names.
crates/perry-codegen/src/expr/calls.rs lowers the factory helpers to DH runtime calls.
crates/perry-stdlib/src/crypto/ecdh.rs and handles.rs implement DiffieHellmanHandle behavior used by those factories.
docs/runtime-parity.md marks class crypto.DiffieHellman and class crypto.DiffieHellmanGroup covered.
docs/api/perry.d.ts declares the factory helpers but no DiffieHellman / DiffieHellmanGroup classes or callable constructors.
Suggested test surface
Add granular crypto inventory/constructor fixtures that check:
Object.keys(require("node:crypto")) includes DiffieHellman and DiffieHellmanGroup
typeof crypto.DiffieHellman === "function" and typeof crypto.DiffieHellmanGroup === "function"
- constructor and callable forms delegate to the same handle behavior as
createDiffieHellman(...) / createDiffieHellmanGroup(...)
- named imports bind:
import { DiffieHellman, DiffieHellmanGroup } from "node:crypto"
Scope / non-goals
This is scoped to the two DH constructor exports and their delegation to the existing DH factory/handle paths. It does not cover additional DH algorithm coverage, exact OpenSSL error text, crypto stream semantics (#2479), KeyObject gaps (#2565), or argument validation (#2013).
No local target/release/perry binary was available for a compiled runtime repro; this issue is based on Node probes plus current origin/main source inspection.
Summary
Node exposes
crypto.DiffieHellmanandcrypto.DiffieHellmanGroupas enumerable callable constructor exports. Perry hascreateDiffieHellman,createDiffieHellmanGroup, andgetDiffieHellmanfactory coverage and DH handle support, but the class constructor exports themselves are missing from the manifest/declarations.This is a narrower export-shape gap than expanding DH algorithm behavior.
Node behavior
On local Node v25.9.0:
Both constructors are callable with and without
new.Current Perry evidence
Current
origin/mainhas factory/handle coverage but not the constructor exports:crates/perry-api-manifest/src/entries.rsregisterscrypto.createDiffieHellman,crypto.createDiffieHellmanGroup, andcrypto.getDiffieHellman, but noclass("crypto", "DiffieHellman"),class("crypto", "DiffieHellmanGroup"), or callable method entries for those constructor names.crates/perry-codegen/src/expr/calls.rslowers the factory helpers to DH runtime calls.crates/perry-stdlib/src/crypto/ecdh.rsandhandles.rsimplementDiffieHellmanHandlebehavior used by those factories.docs/runtime-parity.mdmarksclass crypto.DiffieHellmanandclass crypto.DiffieHellmanGroupcovered.docs/api/perry.d.tsdeclares the factory helpers but noDiffieHellman/DiffieHellmanGroupclasses or callable constructors.Suggested test surface
Add granular crypto inventory/constructor fixtures that check:
Object.keys(require("node:crypto"))includesDiffieHellmanandDiffieHellmanGrouptypeof crypto.DiffieHellman === "function"andtypeof crypto.DiffieHellmanGroup === "function"createDiffieHellman(...)/createDiffieHellmanGroup(...)import { DiffieHellman, DiffieHellmanGroup } from "node:crypto"Scope / non-goals
This is scoped to the two DH constructor exports and their delegation to the existing DH factory/handle paths. It does not cover additional DH algorithm coverage, exact OpenSSL error text, crypto stream semantics (#2479), KeyObject gaps (#2565), or argument validation (#2013).
No local
target/release/perrybinary was available for a compiled runtime repro; this issue is based on Node probes plus currentorigin/mainsource inspection.