Conversation
added 2 commits
June 1, 2026 18:00
The runtime (js_crypto_generate_key_sync) and codegen dispatch (expr/calls.rs) were already complete, and the AES-192/256 KeyObject metadata was fixed by #3930 — but generateKeySync was missing from the API manifest, so the #463 unimplemented-API gate rejected crypto.generateKeySync(...) before codegen ran. Added the manifest method row + a named-import lowering arm (mirroring createSecretKey) so the bare import { generateKeySync } call shape also reaches the dispatch. Flips node-suite/crypto/secret-key/generate-key-sync to green (AES-128/192/256 + hmac all match Node). Remaining crypto fails (cipher state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crypto.generateKeySync("aes"|"hmac", { length })was rejected by the #463 unimplemented-API gate, even though everything behind it was already in place: the runtime (js_crypto_generate_key_sync), the codegen dispatch (expr/calls.rs), and the AES-192/256 KeyObject metadata (fixed by #3930). It was simply missing from the API manifest, so the HIR gate rejected the call before codegen ran. (Confirmed: withPERRY_ALLOW_UNIMPLEMENTED=1the fixture already matched Node byte-for-byte.)Fix
method("crypto", "generateKeySync", …)to the manifest so the dotted-formcrypto.generateKeySync(...)passes the gate and reaches its dispatch.expr_call/globals.rs(mirroring the existingcreateSecretKeyarm) so the bareimport { generateKeySync } from "node:crypto"; generateKeySync(...)shape rewrites to the dotted form too. (A first attempt viacrypto.rs'sis_crypto_methodlist broke the member form — generateKeySync is codegen-dispatched, not runtime-(module,method)-dispatched — so this is the correct spot.)Testing
Flips
node-suite/crypto/secret-key/generate-key-syncto green (AES-128/192/256 metadata + jwk export + hmac all matchnode --experimental-strip-types); the bare named-import form returns the key too.perry-api-manifest+perry-hirsuites green;cargo fmt --checkclean; API docs regenerated. The remainingnode:cryptonode-suite fails (cipher invalid-state #3873, fips-api, prime) are unrelated/pre-existing.Closes #3927