#[non_exhaustive]pub struct DerivedAccount { /* private fields */ }Expand description
A derived HD account — unified across all chains.
Holds the derivation path, a 32-byte private key (always zeroized on
drop), a typed DerivedPublicKey, and the on-chain address string.
Fields are private; use the accessor methods to read them. Hex-encoded
views (private_key_hex,
public_key_hex) are computed on demand.
Chain crates that need to expose chain-specific fields (e.g. BTC WIF,
Solana keypair, Nostr nsec) wrap DerivedAccount in a newtype and
implement AsRef<DerivedAccount> + Deref<Target = DerivedAccount>
on it. This guarantees generic code can always obtain the unified view
without erasing chain-specific information.
Implementations§
Source§impl DerivedAccount
impl DerivedAccount
Sourcepub const fn new(
path: String,
private_key: Zeroizing<[u8; 32]>,
public_key: DerivedPublicKey,
address: String,
) -> DerivedAccount
pub const fn new( path: String, private_key: Zeroizing<[u8; 32]>, public_key: DerivedPublicKey, address: String, ) -> DerivedAccount
Construct a derived account from its components.
Chain crates call this after completing their derivation pipeline.
Sourcepub const fn private_key_bytes(&self) -> &Zeroizing<[u8; 32]>
pub const fn private_key_bytes(&self) -> &Zeroizing<[u8; 32]>
Raw 32-byte private key (zeroized on drop).
Sourcepub fn private_key_hex(&self) -> Zeroizing<String>
pub fn private_key_hex(&self) -> Zeroizing<String>
Lowercase hex-encoded private key (64 chars, zeroized on drop).
Sourcepub const fn public_key(&self) -> &DerivedPublicKey
pub const fn public_key(&self) -> &DerivedPublicKey
Typed public key, carrying algorithm + length information at the type level.
Sourcepub const fn public_key_bytes(&self) -> &[u8] ⓘ
pub const fn public_key_bytes(&self) -> &[u8] ⓘ
Public key bytes, chain-specific layout.
For pattern-matching on the algorithm, use
public_key instead.
Sourcepub fn public_key_hex(&self) -> String
pub fn public_key_hex(&self) -> String
Lowercase hex-encoded public key.
Trait Implementations§
Source§impl AsRef<DerivedAccount> for DerivedAccount
impl AsRef<DerivedAccount> for DerivedAccount
Source§fn as_ref(&self) -> &DerivedAccount
fn as_ref(&self) -> &DerivedAccount
Source§impl Clone for DerivedAccount
impl Clone for DerivedAccount
Source§fn clone(&self) -> DerivedAccount
fn clone(&self) -> DerivedAccount
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more