#[non_exhaustive]pub struct DerivedAccount {
pub path: String,
pub private_key: Zeroizing<String>,
pub public_key: String,
pub address: String,
}Expand description
A derived account from any chain.
Contains the derivation path, key material, and on-chain address. The private key is zeroized on drop.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.path: StringBIP-32/SLIP-10 derivation path used (e.g. m/44'/60'/0'/0/0).
private_key: Zeroizing<String>Private key in hex (zeroized on drop).
public_key: StringPublic key in hex.
address: StringOn-chain address in the chain’s native format.
Implementations§
Source§impl DerivedAccount
impl DerivedAccount
Sourcepub const fn new(
path: String,
private_key: Zeroizing<String>,
public_key: String,
address: String,
) -> Self
pub const fn new( path: String, private_key: Zeroizing<String>, public_key: String, address: String, ) -> Self
Create a new derived account.
Sourcepub fn private_key_bytes(&self) -> Result<Zeroizing<[u8; 32]>, DeriveError>
pub fn private_key_bytes(&self) -> Result<Zeroizing<[u8; 32]>, DeriveError>
Decode the hex-encoded private key into raw 32-byte material.
Every chain deriver in this workspace produces a 32-byte scalar (secp256k1 for EVM/BTC/Cosmos/Tron/Spark/Filecoin/XRPL/Nostr, Ed25519 for SVM/SUI/TON/Aptos), so the output is fixed-length. The returned buffer is zeroized on drop.
§Errors
Returns an error if the stored hex is malformed or not exactly 32 bytes. Derivers in this workspace never produce malformed data, so this error is unexpected in normal use.
Sourcepub fn public_key_bytes(&self) -> Result<Vec<u8>, DeriveError>
pub fn public_key_bytes(&self) -> Result<Vec<u8>, DeriveError>
Decode the hex-encoded public key into raw bytes.
Length is chain-specific: 33 for compressed secp256k1, 65 for uncompressed, 32 for Ed25519 / x-only secp256k1.
§Errors
Returns an error if the stored hex is malformed.
Trait Implementations§
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