Skip to content

PQC: capy pair on envelope v2, P-384 + ML-KEM-1024 (CAP-1027) - #548

Closed
cvince wants to merge 2 commits into
mainfrom
feat/pqc
Closed

cvince wants to merge 2 commits into
mainfrom
feat/pqc

Conversation

@cvince

@cvince cvince commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

CAP-1027: capy pair mints a P-384 + ML-KEM-1024 key (@noble/post-quantum), sends both as public_key, and opens only v:2 envelopes. A v1 (P-256 only) envelope is refused, so the post-quantum half can't be stripped. engines moves to Node >=20.19 so the npm build can require() the ESM-only noble package; the standalone binary bundles it (checked: esbuild bundle includes ml_kem1024).

Linear project: PQC. Envelope v2: CLI public_key = P-384 point (97 B) ‖ ML-KEM-1024 key (1568 B); {v:2, epk, iv, ct} with epk = ephemeral P-384 point ‖ ML-KEM ciphertext; key = HKDF-SHA-384(ECDH ‖ ML-KEM secret, salt = epk, info capy:pair:v2) → AES-256-GCM. No new fields, no DB migration, no new commands.

Rollout

Release only after capysc/capy and capysc/keep-app feat/pqc are deployed. This CLI's 1665-byte key is rejected by today's service, and today's Keep would seal v1.

Test plan

  • bun test tests/crypto/pairCrypto.test.ts tests/commands/pairCommand.test.ts (28 pass), browser sealer moved to v2 in tests/helpers/sealPairV2.ts
  • tsc --noEmit clean; dist loads on Node 22 and returns a 1665-byte key
  • Cross-repo: keep-app feat/pqc sealPairPayload seals, this openPairEnvelope opens

…e v2 (CAP-1027)

generatePairKeyPair mints a P-384 ECDH key and an ML-KEM-1024 key
(@noble/post-quantum) and sends P-384 point || ML-KEM key as public_key.
openPairEnvelope opens only {v:2}: P-384 ECDH + ML-KEM decapsulation,
HKDF-SHA-384(ecdh || kem, salt = epk, info capy:pair:v2), AES-256-GCM.
v1 (P-256 only) envelopes are refused, so the post-quantum half can't be
stripped. engines bumped to Node >=20.19 for require() of the ESM-only
noble package in the npm build; the standalone binary bundles it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjobYubUAofnRVQ6awH2Xf
@cvince cvince self-assigned this Dec 5, 2026
@cvince cvince closed this Dec 5, 2026
@cvince
cvince deleted the feat/pqc branch December 5, 2026 10:29
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.

2 participants