Skip to main content

DerivedAccount

Struct DerivedAccount 

Source
pub struct DerivedAccount { /* private fields */ }
Expand description

A derived HD account — unified across all chains.

Holds the derivation path, a 32-byte private key, a chain-specific public key (33 B compressed / 65 B uncompressed secp256k1 or 32 B Ed25519 / x-only), and the on-chain address string. The private key is zeroized on drop.

Fields are private; use the accessor methods to read them. Hex-encoded views (private_key_hex, public_key_hex) are computed on demand.

Implementations§

Source§

impl DerivedAccount

Source

pub const fn new( path: String, private_key: Zeroizing<[u8; 32]>, public_key: Vec<u8>, address: String, ) -> Self

Construct a derived account from its raw components.

This is the single entry point; chain crates call it after completing their derivation pipeline.

Source

pub fn path(&self) -> &str

BIP-32 / SLIP-10 derivation path (e.g. m/44'/60'/0'/0/0).

Source

pub const fn private_key_bytes(&self) -> &Zeroizing<[u8; 32]>

Raw 32-byte private key (zeroized on drop).

Source

pub fn private_key_hex(&self) -> Zeroizing<String>

Lowercase hex-encoded private key (64 chars, zeroized on drop).

Source

pub fn public_key_bytes(&self) -> &[u8]

Chain-specific public key bytes.

The layout depends on the deriving chain; callers that need a uniform representation should convert with the chain’s documented procedure. Current mapping:

Chain(s)LengthEncoding
kobe-btc, kobe-cosmos, kobe-spark, kobe-xrpl33 Bsecp256k1 compressed (0x02/0x03 prefix + x)
kobe-evm, kobe-fil, kobe-tron65 Bsecp256k1 uncompressed (0x04 prefix + x + y)
kobe-svm, kobe-sui, kobe-aptos, kobe-ton32 BEd25519
kobe-nostr32 BBIP-340 / NIP-19 x-only secp256k1

Cross-chain code that needs a single canonical form should inspect the length and branch accordingly, or rely on chain-specific <Chain>Account newtypes that expose typed views.

Source

pub fn public_key_hex(&self) -> String

Lowercase hex-encoded public key.

Source

pub fn address(&self) -> &str

On-chain address in the chain’s native format.

Trait Implementations§

Source§

impl Clone for DerivedAccount

Source§

fn clone(&self) -> DerivedAccount

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DerivedAccount

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V