feat(key-wallet): add Signer::extended_public_key#817
Conversation
The Signer trait exposes sign_ecdsa + public_key, the latter returning only the compressed leaf point. A caller that needs a BIP-32 extended public key at a hardened path — e.g. DashPay contact-xpub derivation under m/9'/coin'/15'/account'/sender/recipient — could not obtain the chain code without the wallet's resident root private key, forcing the seed to be made resident. Add a required extended_public_key(path) -> ExtendedPubKey method so a Keychain/hardware-backed signer can return the point + chain code + parent fingerprint at a (possibly hardened) path, letting the caller non-hardened-derive descendants offline with no resident seed. A signer that cannot export an xpub at a hardened path returns an error rather than panicking. The two in-repo InMemorySigner test signers derive it from their root xprv (ExtendedPubKey::from_priv); the NoDigestSigner test stubs are unreachable. Pinned by a test asserting the signer's xpub at a hardened path equals the wallet's own derive_extended_public_key. Required (not defaulted): the trait's associated Error type is opaque, so a default body cannot construct a Self::Error to return; there are no production Signer impls in this crate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds a new async ChangesSigner::extended_public_key addition
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #817 +/- ##
==========================================
+ Coverage 72.82% 73.03% +0.21%
==========================================
Files 323 323
Lines 72000 72025 +25
==========================================
+ Hits 52432 52602 +170
+ Misses 19568 19423 -145
|
What
Adds a required
extended_public_key(path) -> ExtendedPubKeymethod to thekey_wallet::signer::Signertrait.Why
The trait exposes
sign_ecdsa+public_key, the latter returning only the compressed leaf point. A caller that needs a BIP-32 extended public key at a hardened path — e.g. DashPay contact-xpub derivation underm/9'/coin'/15'/account'/sender/recipient— could not obtain the chain code without the wallet's resident root private key, forcing the seed to be made resident.This lets a Keychain/hardware-backed signer return the point + chain code + parent fingerprint at a (possibly hardened) path, so the caller can non-hardened-derive descendants offline with no resident seed. It unblocks the dashpay-platform work to delete the
attach_wallet_seedworkaround (the wallet stays external-signable; the signer answers xpub requests).Details
InMemorySignertest signers derive it from their root xprv (ExtendedPubKey::from_priv); theNoDigestSignertest stubs areunreachable!().derive_extended_public_key.Errortype is opaque, so a default body cannot construct aSelf::Errorto return; there are no productionSignerimpls in this crate.Test
cargo test -p key-wallet --lib— 497 passed, 0 failed. fmt + clippy clean.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests