rustywallet_hd/lib.rs
1//! # rustywallet-hd
2//!
3//! BIP32/BIP44 Hierarchical Deterministic wallet for cryptocurrency key derivation.
4//!
5//! This crate provides functionality to:
6//! - Create master keys from seeds
7//! - Derive child keys using BIP32 derivation
8//! - Support BIP44 standard paths
9//! - Export/import extended keys (xprv/xpub)
10//!
11//! ## Example
12//!
13//! ```
14//! use rustywallet_hd::prelude::*;
15//!
16//! // Create master key from seed (64 bytes, typically from mnemonic)
17//! let seed = [0u8; 64];
18//! let master = ExtendedPrivateKey::from_seed(&seed, Network::Mainnet).unwrap();
19//!
20//! // Derive BIP44 Bitcoin path: m/44'/0'/0'/0/0
21//! let path = DerivationPath::bip44_bitcoin(0, 0, 0);
22//! let child = master.derive_path(&path).unwrap();
23//!
24//! // Get keys
25//! let private_key = child.private_key().unwrap();
26//! let public_key = child.public_key();
27//!
28//! // Export as xprv/xpub
29//! let xprv = child.to_xprv();
30//! let xpub = child.extended_public_key().to_xpub();
31//! ```
32//!
33//! ## BIP44 Paths
34//!
35//! ```text
36//! m / purpose' / coin_type' / account' / change / address_index
37//!
38//! Bitcoin: m/44'/0'/0'/0/0
39//! Ethereum: m/44'/60'/0'/0/0
40//! ```
41//!
42//! ## Security
43//!
44//! - Private keys and chain codes are zeroized on drop
45//! - Debug output masks sensitive data
46//! - Hardened derivation prevents public key derivation
47
48pub mod error;
49pub mod extended_key;
50pub mod network;
51pub mod path;
52pub mod prelude;
53
54pub use error::HdError;
55pub use extended_key::{ExtendedPrivateKey, ExtendedPublicKey};
56pub use network::Network;
57pub use path::{ChildNumber, DerivationPath};