Expand description
Kobe core primitives — the foundation of every chain crate.
This crate owns the type system shared by every kobe-<chain> crate:
the Wallet entry point, the Derive / DeriveExt traits, the
typed DerivedPublicKey enum, the unified DeriveError, and the
BIP-32 / SLIP-10 / Camouflage primitives that chain crates compose.
§Module map
Wallet (mnemonic + 64-byte BIP-39 seed)
┌─────┴─────┐
derive_secp256k1│ │ derive_ed25519
▼ ▼
bip32::DerivedSecp256k1Key slip10::DerivedEd25519Key
│ │
used by EVM / Cosmos / │ used by Solana / Sui /
Tron / Spark / Fil / │ Aptos / TON
XRPL / Nostr │
└─────┬─────┘
▼
DerivedAccount ─◄── every chain wraps this
(path + sk + pk + address)camouflage is an orthogonal utility (entropy-layer XOR encryption
that turns one BIP-39 mnemonic into another) gated behind its own feature.
§Zeroize policy
Every sensitive byte string is wiped when dropped:
Wallet— zeroizes the mnemonic and the 64-byte seed.DerivedAccount::private_key_bytes/private_key_hex— hand out&Zeroizing<…>orZeroizing<…>copies.bip32::DerivedSecp256k1Key/slip10::DerivedEd25519Key— zeroize their signing key material, chain code, and every byte view.camouflage::encrypt/camouflage::decrypt— returnZeroizing<String>.
Public keys and on-chain addresses are not zeroized: by design they carry no secret material.
§no_std surface
| Feature | Needs alloc | Purpose |
|---|---|---|
std (default) | ✔ | std::error::Error, OS RNG |
alloc | ✔ | Wallet, DerivedAccount, mnemonic |
bip32 | ✔ | bip32::DerivedSecp256k1Key |
slip10 | ✔ | slip10::DerivedEd25519Key |
camouflage | ✔ | camouflage (PBKDF2 XOR helpers) |
rand / rand_core | ✔ | Wallet::generate |
test-vectors | ✗ | Re-export of canonical BIP-39 fixtures |
Only DeriveError and test_vectors compile in pure no_std
without alloc. Everything else requires at least alloc.
§Quick tour
use kobe_primitives::Wallet;
// 1. Build a wallet from a BIP-39 mnemonic:
let wallet = Wallet::from_mnemonic(
"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
None,
)?;
// 2. Derive secp256k1 / Ed25519 keys at BIP-32 / SLIP-10 paths
// (enable the `bip32` / `slip10` features):
assert_eq!(wallet.derive_secp256k1("m/44'/60'/0'/0/0")?.compressed_pubkey().len(), 33);
assert_eq!(wallet.derive_ed25519("m/44'/501'/0'/0'")?.public_key_bytes().len(), 32);For chain-specific derivation (Bitcoin addresses, Ethereum checksummed
addresses, Solana keypairs, etc.), reach for the matching chain crate
(kobe-btc, kobe-evm, kobe-svm, …) via the kobe umbrella crate.
Re-exports§
pub use bip39::rand_core;
Modules§
- bip32
- BIP-32 secp256k1 key derivation utilities.
- camouflage
- Mnemonic camouflage via entropy-layer XOR encryption.
- mnemonic
- BIP-39 mnemonic utilities.
- slip10
- SLIP-0010 Ed25519 key derivation.
- test_
vectors - Well-known BIP-39 / SLIP-10 test vectors, exposed for downstream test suites.
Structs§
- Derived
Account - A derived HD account — unified across all chains.
- Parse
Derivation Style Error - Error returned when
FromStrfails on a chain’sDerivationStyle. - Wallet
- A unified HD wallet that can derive keys for multiple cryptocurrencies.
Enums§
- Derive
Error - Errors produced by HD derivation, mnemonic handling, and address encoding.
- Derived
Public Key - Strongly typed public key emitted by an HD derivation.
- Language
- Language to be used for the mnemonic phrase.
- Public
KeyKind - Tag describing
DerivedPublicKey’s variant without carrying the bytes.
Traits§
- Derivation
Style - Trait implemented by every chain’s
DerivationStyleenum. - Derive
- Unified derivation trait implemented by every chain deriver.
- Derive
Ext - Extension trait providing batch derivation for every
Deriveimplementor.
Functions§
- derive_
range - Derive a range of accounts by repeatedly invoking a derivation closure.
Type Aliases§
- Result
- Convenient Result alias.