pub struct Deriver<'a> { /* private fields */ }Expand description
Casper address deriver from a unified wallet seed.
Default algorithm is KeyAlgo::Secp256k1 (Ledger path). Switch with
with_algo or per-call derive_with.
Implementations§
Source§impl<'a> Deriver<'a>
impl<'a> Deriver<'a>
Sourcepub const fn new(wallet: &'a Wallet) -> Self
pub const fn new(wallet: &'a Wallet) -> Self
Create a deriver with the default algorithm (KeyAlgo::Secp256k1).
Sourcepub const fn with_algo(wallet: &'a Wallet, algo: KeyAlgo) -> Self
pub const fn with_algo(wallet: &'a Wallet, algo: KeyAlgo) -> Self
Create a deriver locked to algo for Derive::derive /
Derive::derive_path.
Sourcepub const fn algo(&self) -> KeyAlgo
pub const fn algo(&self) -> KeyAlgo
Algorithm used by Derive::derive and Derive::derive_path.
Sourcepub fn derive(&self, index: u32) -> Result<CasperAccount, DeriveError>
pub fn derive(&self, index: u32) -> Result<CasperAccount, DeriveError>
Derive at the default path for the deriver’s algorithm.
§Errors
Returns an error if key derivation or AccountHash hashing fails.
Sourcepub fn derive_with(
&self,
algo: KeyAlgo,
index: u32,
) -> Result<CasperAccount, DeriveError>
pub fn derive_with( &self, algo: KeyAlgo, index: u32, ) -> Result<CasperAccount, DeriveError>
Derive at the default path for an explicit algorithm.
§Errors
Returns an error if key derivation or AccountHash hashing fails.
Sourcepub fn derive_at(&self, path: &str) -> Result<CasperAccount, DeriveError>
pub fn derive_at(&self, path: &str) -> Result<CasperAccount, DeriveError>
Derive at an arbitrary path using the deriver’s stored algorithm for
tagging / AccountHash.
Prefer derive_at_with when the path and
algorithm must be specified together.
§Errors
Returns an error if key derivation or AccountHash hashing fails.
Sourcepub fn derive_at_with(
&self,
path: &str,
algo: KeyAlgo,
) -> Result<CasperAccount, DeriveError>
pub fn derive_at_with( &self, path: &str, algo: KeyAlgo, ) -> Result<CasperAccount, DeriveError>
Derive at an arbitrary path with an explicit algorithm (encoding).
The path must be valid for the curve of algo (BIP-32 for secp,
fully hardened SLIP-10 for Ed25519).
§Errors
Returns an error if key derivation or AccountHash hashing fails.