Skip to content

feat(sdk-lib-mpc): add VrfDkg wrapper for DKLS VRF keygen - #9650

Merged
s84krish merged 1 commit into
masterfrom
WCN-2446
Sep 4, 2026
Merged

feat(sdk-lib-mpc): add VrfDkg wrapper for DKLS VRF keygen#9650
s84krish merged 1 commit into
masterfrom
WCN-2446

Conversation

@s84krish

@s84krish s84krish commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Ticket: WCN-2446

Adds a standalone round-driver for the DKLS VRF DKG — VrfDkg — to sdk-lib-mpc, letting one party (user/backup/BitGo) run its side of a 2-of-3 VRF key generation. This is the crypto primitive for safe MPC root
keys that carry a VRF share for hardened derivation; it wraps the VrfKeygenSession wasm (deps added in #9635) behind the same session-persistence and message-handling patterns as the existing signing Dkg, and
reuses the existing comms layer unchanged. No platform, wire-format, or createKeychains changes — the driver is fully exercisable with a local 3-party in-process run.

Changes

  • src/tss/dkls-vrf/dkg.ts — VrfDkg class: initDkg() (broadcast commitment), handleIncomingMessages() (round routing incl. the measured n−1 / n message asymmetry; round-2 openings are emitted per-recipient),
    getKeyShare() / getPublicKey() / getKeyId() / getRootChainCode(), and getSessionData() / restoreSession() with round state re-derived from the wasm session bytes (_deserializeState) rather than trusted from
    the caller.
  • src/tss/dkls-vrf/types.ts — VrfDkgState + VrfDkgSessionData (own enum, kept separate from DkgState since round counts differ).
  • src/tss/dkls-vrf/util.ts — generateVrfDKGKeyShares() local 3-party helper, mirroring generateDKGKeyShares.
  • src/tss/dkls-vrf/index.ts + src/tss/index.ts — exported as DklsVrf, matching the DklsDkg/DklsComms naming convention.
  • test/unit/tss/dkls-vrf/dkg.ts — 10 tests: 3-party agreement on publicKey/keyId/rootChainCode, deterministic pinned seed fixture, full round-trip through the comms layer (openpgp sign/verify),
    serialize/deserialize round-trip, session restore after each round, and rejection cases (wrong message count, duplicate senders, early getKeyShare).

@linear-code

linear-code Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

WCN-2446

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

@s84krish
s84krish marked this pull request as ready for review September 4, 2026 01:22
@s84krish
s84krish requested review from a team as code owners September 4, 2026 01:22
@s84krish
s84krish merged commit 5f27e94 into master Sep 4, 2026
25 checks passed
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