Skip to content

[codex] expose subtle encapsulation method surface#4292

Closed
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-webcrypto-encapsulation-methods
Closed

[codex] expose subtle encapsulation method surface#4292
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-webcrypto-encapsulation-methods

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Part of #2518.

Scope

  • Exposes SubtleCrypto.prototype.encapsulateBits, decapsulateBits, encapsulateKey, and decapsulateKey with Node-shaped callable method names, lengths, and enumerable/writable/configurable descriptors.
  • Routes direct crypto.subtle calls plus captured/dynamic crypto.subtle method calls through the WebCrypto dispatcher instead of surfacing undefined.
  • Matches Node 26 missing-argument behavior by returning a rejected Promise with TypeError [ERR_MISSING_ARGS] and the WebIDL-style message.
  • Returns an explicit unsupported WebCrypto rejection for non-missing encapsulation execution paths rather than silently missing the method.

Non-goals

  • Implementing ML-KEM encapsulation/decapsulation execution.
  • Advertising ML-KEM support through SubtleCrypto.supports().
  • Changing P-384/P-521 WebCrypto support, which is tracked separately.

Validation

  • npm exec --yes --package=node@26 -- node test-parity/node-suite/crypto/webcrypto/subtle-encapsulation-methods.ts
  • CARGO_TARGET_DIR=/tmp/perry-webcrypto-encap-check cargo check -p perry-hir -p perry-codegen -p perry-runtime -p perry-stdlib
  • Direct Perry compile/run of test-parity/node-suite/crypto/webcrypto/subtle-encapsulation-methods.ts with PERRY_NO_AUTO_OPTIMIZE=1
  • PERRY_NO_AUTO_OPTIMIZE=1 CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/perry-webcrypto-encap-build npm exec --yes --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module crypto --filter subtle-encapsulation-methods'
  • PERRY_NO_AUTO_OPTIMIZE=1 CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/perry-webcrypto-encap-build npm exec --yes --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module crypto --filter subtle-supports'
  • PERRY_NO_AUTO_OPTIMIZE=1 CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/perry-webcrypto-encap-build npm exec --yes --package=node@26 -- bash -lc './run_parity_tests.sh --suite node-suite --module crypto --filter global-webcrypto-globals'
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh

@andrewtdiz
Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #4291, which already covers the same #2518 WebCrypto encapsulation method surface. Keeping review focused there.

@andrewtdiz andrewtdiz closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant