1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Casper Network wallet utilities for Kobe.
//!
//! Offline HD derivation for **CSPR** (SLIP-44 coin type `506`) with dual
//! signature algorithms:
//!
//! | Algorithm | Default path | Curve | Kobe primitive |
//! | --- | --- | --- | --- |
//! | [`KeyAlgo::Secp256k1`] (default) | `m/44'/506'/0'/0/{i}` | secp256k1 | BIP-32 |
//! | [`KeyAlgo::Ed25519`] | `m/44'/506'/0'/0'/{i}'` | Ed25519 | SLIP-10 |
//!
//! # Address encoding
//!
//! The primary [`DerivedAccount::address`] is the Casper **`AccountHash`**
//! display form `account-hash-` + 64 lowercase hex digits.
//!
//! Per [`casper-types`](https://github.com/casper-network/casper-node)
//! `AccountHash::from_public_key`, the `BLAKE2b`-256 preimage is **not** the
//! tag-prefixed public-key serialization. It is:
//!
//! ```text
//! algorithm_name_ascii || 0x00 || raw_public_key_bytes
//! ```
//!
//! where `algorithm_name` is the lowercase ASCII string `"secp256k1"` or
//! `"ed25519"`, and `raw_public_key_bytes` is the 33-byte compressed `SEC1`
//! secp256k1 key or the 32-byte Ed25519 key (no algorithm tag byte).
//!
//! The algorithm-tagged public-key hex used in Casper serialization /
//! CEP-57 contexts (`0x01 ‖ ed25519` or `0x02 ‖ secp compressed`) is
//! exposed separately on [`CasperAccount::tagged_public_key_hex`].
//!
//! # Example
//!
//! ```no_run
//! use kobe_casper::{Deriver, KeyAlgo};
//! use kobe_primitives::{Derive, Wallet};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let wallet = Wallet::from_mnemonic(
//! "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
//! None,
//! )?;
//! let account = Deriver::new(&wallet).derive(0)?;
//! assert!(account.address().starts_with("account-hash-"));
//! assert_eq!(account.algo(), KeyAlgo::Secp256k1);
//! # Ok(())
//! # }
//! ```
extern crate alloc;
pub use ;
pub use ;
pub use KeyAlgo;
pub use ;