Skip to content

fix(crypto): add WebCrypto ML-KEM key material#4340

Draft
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-webcrypto-mlkem-keys
Draft

fix(crypto): add WebCrypto ML-KEM key material#4340
andrewtdiz wants to merge 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-webcrypto-mlkem-keys

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

@andrewtdiz andrewtdiz commented Jun 4, 2026

Summary

  • add WebCrypto CryptoKey metadata and usage support for ML-KEM-512, ML-KEM-768, and ML-KEM-1024
  • implement ML-KEM generateKey, SPKI/PKCS8 import/export, and AKP JWK import/export using pub plus 64-byte priv seed validation
  • report SubtleCrypto.supports() true for ML-KEM generate/import/export and add focused Node 26 parity coverage

Scope

This is the ML-KEM key-material slice only. It intentionally does not implement encapsulateBits, decapsulateBits, encapsulateKey, or decapsulateKey execution; the method surface is handled separately in #4291.

Validation

  • PATH="/root/.npm/_npx/bac97da9607b7ef2/node_modules/node/bin:$PATH" node --experimental-strip-types test-parity/node-suite/crypto/webcrypto/mlkem-key-material.ts
  • CARGO_TARGET_DIR=/root/perry-worktrees/.build-targets/perry-webcrypto-mlkem-check cargo check -p perry-stdlib --no-default-features --features crypto
  • PATH="/root/.npm/_npx/bac97da9607b7ef2/node_modules/node/bin:$PATH" PERRY_NO_AUTO_OPTIMIZE=1 ./run_parity_tests.sh --suite node-suite --module crypto/webcrypto --filter mlkem-key-material
    • report: test-parity/reports/parity_report_20260604_034747.json
  • PATH="/root/.npm/_npx/bac97da9607b7ef2/node_modules/node/bin:$PATH" PERRY_NO_AUTO_OPTIMIZE=1 ./run_parity_tests.sh --suite node-suite --module crypto/webcrypto --filter subtle-supports
    • report: test-parity/reports/parity_report_20260604_034800.json
  • PATH="/root/.npm/_npx/bac97da9607b7ef2/node_modules/node/bin:$PATH" PERRY_NO_AUTO_OPTIMIZE=1 ./run_parity_tests.sh --suite node-suite --module crypto/webcrypto --filter jwk-ecdh-p256
  • PATH="/root/.npm/_npx/bac97da9607b7ef2/node_modules/node/bin:$PATH" PERRY_NO_AUTO_OPTIMIZE=1 ./run_parity_tests.sh --suite node-suite --module crypto/webcrypto --filter jwk-rsa-oaep
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh

Refs #2518

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