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
impl DerivedAccount
Sourcepub const fn new(
path: String,
private_key: Zeroizing<[u8; 32]>,
public_key: Vec<u8>,
address: String,
) -> Self
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.
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 fn public_key_bytes(&self) -> &[u8] ⓘ
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) | Length | Encoding |
|---|---|---|
kobe-btc, kobe-cosmos, kobe-spark, kobe-xrpl | 33 B | secp256k1 compressed (0x02/0x03 prefix + x) |
kobe-evm, kobe-fil, kobe-tron | 65 B | secp256k1 uncompressed (0x04 prefix + x + y) |
kobe-svm, kobe-sui, kobe-aptos, kobe-ton | 32 B | Ed25519 |
kobe-nostr | 32 B | BIP-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.
Sourcepub fn public_key_hex(&self) -> String
pub fn public_key_hex(&self) -> String
Lowercase hex-encoded public key.
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