Files
suaveplan/.github/pull_request_template/flip-primitive.md
2026-05-27 23:29:53 +01:00

2.0 KiB

Flip primitive to native

This PR changes one or more crypto.config.ts entries from 'noble' to 'native'. Landing a flip permanently swaps the repo's routing for the primitive — every consumer picks up the in-house implementation on the next build.

Do not merge this PR without every box checked. Dangerous-tier primitives (curves, AEADs, argon2id) additionally require a linked audit document.

Primitive(s) affected

  • <primitive-id>: noble → native

Gate 1 — KAT (known-answer tests)

  • All vectors pass on the new impl.
  • Link to the KAT run:

Gate 2 — Differential fuzz history

  • At least 7 consecutive nightly crypto:fuzz runs pass native-vs-noble with zero mismatches.
  • Link to the 7-day nightly history:

Gate 3 — Timing report

  • crypto:timing run for this primitive reports constantTime: true against the default threshold (t < 4.5).
  • Link to the timing report:

Audit document (dangerous tier only)

Required for: secp256k1, ed25519, x25519, p256, aes-256-gcm, chacha20-poly1305, xchacha20-poly1305, argon2id.

  • N/A — primitive is not dangerous tier.
  • Audit document linked below. Include: reviewer name, scope, findings, sign-off date.

Rollback plan

  • Reverting crypto.config.ts and regenerating selects restores noble routing with zero other changes.
  • Legacy noble impl at impl/<id>.noble.ts is untouched by this PR.

Checklist

  • bun scripts/gen-crypto-selects.ts has been run and <id>.select.ts has been updated to re-export from ./impl/<id>.native.js.
  • bun scripts/check-crypto-selects.ts is green.
  • bun scripts/ct-lint.ts is green.
  • bunx turbo lint typecheck test is green across every crypto-* package.