feat: add account derivation functions for extended private keys#132
feat: add account derivation functions for extended private keys#132QuantumExplorer merged 2 commits intov0.40-devfrom
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughAdds a new account_derivation FFI module and public APIs for deriving extended/private keys from xpriv, seed, or mnemonic (including BLS and EdDSA variants), updates headers and docs, introduces supporting key wrappers, and extends core AccountDerivation trait/impls. Removes DIP9 identity key derivation API and its tests; wires the new module in lib. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant FFI as FFI account_derive_private_key_from_mnemonic
participant Acc as Account (Rust)
participant Der as AccountDerivation Trait
participant Mn as Mnemonic
participant Seed as Seed Derivation
Caller->>FFI: account_derive_private_key_from_mnemonic(account, mnemonic, passphrase, index)
FFI->>FFI: Validate pointers, init FFIError
FFI->>Mn: parse mnemonic
Mn-->>FFI: Mnemonic or error
FFI->>Seed: to_seed(mnemonic, passphrase)
Seed-->>FFI: seed bytes
FFI->>Acc: account.inner()
Acc->>Der: derive_from_seed_private_key_at(seed, index)
Der-->>FFI: PrivateKey or error
alt success
FFI-->>Caller: FFIPrivateKey*
else error
FFI-->>Caller: null + FFIError
end
sequenceDiagram
autonumber
actor Caller
participant FFI as FFI account_derive_private_key_at
participant Acc as Account (Rust)
participant Der as AccountDerivation Trait
Caller->>FFI: account_derive_private_key_at(account, master_xpriv, index)
FFI->>FFI: Validate pointers, ensure not watch-only
FFI->>Acc: account.inner()
Acc->>Der: derive_from_master_xpriv_private_key_at(master_xpriv, index)
Der-->>FFI: PrivateKey or error
alt success
FFI-->>Caller: FFIPrivateKey*
else error
FFI-->>Caller: null + FFIError
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (12)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
This was done to have an easier way for clients to access private keys for viewing.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests
Revert