feat: add CKD support (derivation_path + client-side key derivation)#4
Open
ImmuneFOMO wants to merge 2 commits intofystack:masterfrom
Open
feat: add CKD support (derivation_path + client-side key derivation)#4ImmuneFOMO wants to merge 2 commits intofystack:masterfrom
ImmuneFOMO wants to merge 2 commits intofystack:masterfrom
Conversation
Author
|
Hello, @anhthii , would love to get your thoughts on this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Added
derivation_pathsupport tosignTransaction()and a newckdutilmodule 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 passderivation_pathor derive child keys locally.Changes
Signing:
derivation_path?: number[]added toSignTxMessagetypederivationPathparam added tosignTransaction()- passes through to wire messageRaw()behavior)ckdutil module (new, mirrors Go
pkg/ckdutil):deriveSecp256k1ChildCompressed()- BIP-32 non-hardened derivation on secp256k1deriveEd25519ChildCompressed()- same for ed25519deriveEthereumAddress()- convenience: derivation + keccak256 addresscompressPublicKey()- 64/65-byte uncompressed → 33-byte compressedTests:
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.