Summary
Several node:crypto exports are already recognized as callable by Perry's runtime/codegen, and docs/runtime-parity.md marks them covered, but they are missing from perry-api-manifest and generated API declarations/reference docs.
This is a manifest/declaration coherence gap: strict native-member checks and declaration-guided users can miss or reject APIs that the runtime already exposes.
Node behavior
On local Node v25.9.0, the following are enumerable node:crypto exports with function/class shape:
const crypto = require("node:crypto");
for (const name of [
"Hash", "Hmac", "Sign", "Verify",
"checkPrime", "checkPrimeSync",
"generateKey", "generateKeySync",
"generateKeyPair", "generateKeyPairSync",
"generatePrime", "generatePrimeSync",
"getCipherInfo", "hkdf", "scrypt",
"secureHeapUsed", "setFips",
]) {
console.log(name, typeof crypto[name], crypto[name].length);
}
Representative Node results:
Hash, Hmac, Sign, Verify are function-valued constructor exports.
checkPrime / checkPrimeSync, generateKey*, generateKeyPair*, generatePrime*, getCipherInfo, hkdf, scrypt, secureHeapUsed, and setFips are enumerable functions.
Current Perry evidence
Current origin/main has implementation/coverage evidence for this cluster:
crates/perry-runtime/src/object/native_module.rs::is_native_module_callable_export() lists the names above as callable crypto exports.
crates/perry-codegen/src/expr/calls.rs has direct lowering for:
- legacy
crypto.Hash / crypto.Hmac / crypto.Sign / crypto.Verify call paths
generateKey, generateKeySync, generateKeyPair, generateKeyPairSync
generatePrime, generatePrimeSync, checkPrime, checkPrimeSync
getCipherInfo, hkdf, scrypt, secureHeapUsed, and setFips
crates/perry-stdlib/src/crypto/ contains backing implementations such as js_crypto_generate_key_sync, js_crypto_generate_key_async, js_crypto_generate_key_pair_async, js_crypto_generate_prime_sync, js_crypto_check_prime_sync, js_crypto_hkdf_async_alg, js_crypto_scrypt_async, js_crypto_get_cipher_info, and js_crypto_secure_heap_used.
docs/runtime-parity.md marks these rows covered in the node:crypto section.
But the manifest/declarations omit them:
crates/perry-api-manifest/src/entries.rs has entries for adjacent crypto APIs such as createHash, createHmac, pbkdf2, pbkdf2Sync, scryptSync, hkdfSync, generateKeyPairSync, and cipher/sign helpers, but omits much of the callable cluster above.
docs/api/perry.d.ts does not declare these exports for module "crypto".
docs/src/api/reference.md does not list these exports.
Suggested test surface
Add manifest/API regression coverage that checks:
module_has_symbol("crypto", name) succeeds for the implemented callable cluster above.
docs/api/perry.d.ts includes function/class declarations for these names.
- Existing granular crypto fixtures for key generation, KDFs, primes, cipher info, and legacy constructor aliases remain covered.
Scope / non-goals
This is scoped to manifest/declaration/reference-doc coherence for APIs already recognized by Perry runtime/codegen. It excludes crypto.randomFill, which is tracked separately in #2691, argument validation (#2013), WebCrypto/global constructor work (#2576), KeyObject gaps (#2565), Argon2/encapsulation APIs (#2517), and behavior improvements for algorithms that are already tracked elsewhere.
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
Several
node:cryptoexports are already recognized as callable by Perry's runtime/codegen, anddocs/runtime-parity.mdmarks them covered, but they are missing fromperry-api-manifestand generated API declarations/reference docs.This is a manifest/declaration coherence gap: strict native-member checks and declaration-guided users can miss or reject APIs that the runtime already exposes.
Node behavior
On local Node v25.9.0, the following are enumerable
node:cryptoexports with function/class shape:Representative Node results:
Hash,Hmac,Sign,Verifyare function-valued constructor exports.checkPrime/checkPrimeSync,generateKey*,generateKeyPair*,generatePrime*,getCipherInfo,hkdf,scrypt,secureHeapUsed, andsetFipsare enumerable functions.Current Perry evidence
Current
origin/mainhas implementation/coverage evidence for this cluster:crates/perry-runtime/src/object/native_module.rs::is_native_module_callable_export()lists the names above as callablecryptoexports.crates/perry-codegen/src/expr/calls.rshas direct lowering for:crypto.Hash/crypto.Hmac/crypto.Sign/crypto.Verifycall pathsgenerateKey,generateKeySync,generateKeyPair,generateKeyPairSyncgeneratePrime,generatePrimeSync,checkPrime,checkPrimeSyncgetCipherInfo,hkdf,scrypt,secureHeapUsed, andsetFipscrates/perry-stdlib/src/crypto/contains backing implementations such asjs_crypto_generate_key_sync,js_crypto_generate_key_async,js_crypto_generate_key_pair_async,js_crypto_generate_prime_sync,js_crypto_check_prime_sync,js_crypto_hkdf_async_alg,js_crypto_scrypt_async,js_crypto_get_cipher_info, andjs_crypto_secure_heap_used.docs/runtime-parity.mdmarks these rows covered in thenode:cryptosection.But the manifest/declarations omit them:
crates/perry-api-manifest/src/entries.rshas entries for adjacent crypto APIs such ascreateHash,createHmac,pbkdf2,pbkdf2Sync,scryptSync,hkdfSync,generateKeyPairSync, and cipher/sign helpers, but omits much of the callable cluster above.docs/api/perry.d.tsdoes not declare these exports formodule "crypto".docs/src/api/reference.mddoes not list these exports.Suggested test surface
Add manifest/API regression coverage that checks:
module_has_symbol("crypto", name)succeeds for the implemented callable cluster above.docs/api/perry.d.tsincludes function/class declarations for these names.Scope / non-goals
This is scoped to manifest/declaration/reference-doc coherence for APIs already recognized by Perry runtime/codegen. It excludes
crypto.randomFill, which is tracked separately in #2691, argument validation (#2013), WebCrypto/global constructor work (#2576), KeyObject gaps (#2565), Argon2/encapsulation APIs (#2517), and behavior improvements for algorithms that are already tracked elsewhere.No local
target/release/perrybinary was available for a compiled runtime repro; this issue is based on Node probes plus currentorigin/mainsource inspection.