Skip to content

feat: add CKD support (derivation_path + client-side key derivation)#4

Open
ImmuneFOMO wants to merge 2 commits intofystack:masterfrom
ImmuneFOMO:master
Open

feat: add CKD support (derivation_path + client-side key derivation)#4
ImmuneFOMO wants to merge 2 commits intofystack:masterfrom
ImmuneFOMO:master

Conversation

@ImmuneFOMO
Copy link

What
Added derivation_path support to signTransaction() and a new ckdutil module for client-side BIP-32 non-hardened child key derivation.
The Go server already supports CKD at signing time (pkg/mpc/ckd.go, pkg/ckdutil/child_derivation.go), but the TS client had no way to pass derivation_path or derive child keys locally.

Changes

Signing:

  • derivation_path?: number[] added to SignTxMessage type
  • derivationPath param added to signTransaction() - passes through to wire message
  • Excluded from signature payload (matches Go Raw() behavior)
    ckdutil module (new, mirrors Go pkg/ckdutil):
  • deriveSecp256k1ChildCompressed() - BIP-32 non-hardened derivation on secp256k1
  • deriveEd25519ChildCompressed() - same for ed25519
  • deriveEthereumAddress() - convenience: derivation + keccak256 address
  • compressPublicKey() - 64/65-byte uncompressed → 33-byte compressed
    Tests:
  • Unit tests for both curves, including BIP-32 Test Vector 2 verification
  • SignTxMessage payload assertions (derivation_path present/absent)
    Deps:
  • @noble/curves, @noble/hashes (runtime)
  • vitest (dev)

Use case

Enables HD wallet architecture: one master wallet via DKG, user wallets derived by index at signing time. No per-user keygen needed, a single backup at init time is enough to restore all wallets if the server dies.

@ImmuneFOMO
Copy link
Author

Hello, @anhthii , would love to get your thoughts on this PR

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