Skip to content

refactor(ecdh): P-521 hygiene pass — hoist constants, BigInt literals, reformat#59

Merged
jacaudi merged 4 commits into
mainfrom
refactor/ecdh-hygiene-pass
Apr 12, 2026
Merged

refactor(ecdh): P-521 hygiene pass — hoist constants, BigInt literals, reformat#59
jacaudi merged 4 commits into
mainfrom
refactor/ecdh-hygiene-pass

Conversation

@jacaudi
Copy link
Copy Markdown
Owner

@jacaudi jacaudi commented Apr 12, 2026

Summary

  • Hoists P-521 curve constants (P521) out of the determineEcdh constructor to module scope — no reason to rebuild the same 6 BigInts on every instantiation
  • Modernizes BigInt(N) calls to Nn literal syntax (e.g. BigInt(0)0n) for numeric literals; leaves BigInt("0x...") hex strings and BigInt(seedView[i]) runtime access untouched
  • Reformats src/js/worker/ecdh.js for 4-space indentation, consistent operator spacing, and one statement per line

Zero algorithmic changes. A new determinism test (app/tests/test-ecdh-determinism.js) pins the fixed-seed generateKeyPair(seed) output — private key and public point coordinates — and runs after every commit to catch accidental math drift from the reformat.

Test plan

  • node --test app/tests/test-ecdh-determinism.js passes after each of the 3 refactor commits
  • Full suite: 168/168 passing (166 baseline + 2 new determinism tests)
  • Manual browser round-trip: encrypt + decrypt, share-key generation, verify public key exports to ?pub= URL

🤖 Generated with Claude Code

jacaudi and others added 4 commits April 12, 2026 14:03
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jacaudi jacaudi merged commit 6f9c1b2 into main Apr 12, 2026
13 checks passed
jacaudi added a commit that referenced this pull request Apr 13, 2026
Empty commit to trigger semantic-release. The five refactor PRs that
landed after v0.7.2 (buffer sharing, query-string parser rewrite,
secureOverwriteBuffer simplification, doStuff/undoStuff unification,
ECDH P-521 hygiene pass) use conventional commit types that don't
bump the version, so this commit ships them as v0.7.3.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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