pub struct DerivedSecretKey { /* private fields */ }Expand description
Secret key and chain code used for hierarchical key derivation.
Implementations§
Source§impl DerivedSecretKey
impl DerivedSecretKey
Sourcepub fn new(
mnemonic: &Mnemonic,
password: &str,
algorithm: Algorithm,
) -> Result<Self>
pub fn new( mnemonic: &Mnemonic, password: &str, algorithm: Algorithm, ) -> Result<Self>
Derives a master key from a mnemonic.
Sourcepub fn bip39(
mnemonic: &Mnemonic,
password: &str,
algorithm: Algorithm,
) -> Result<Self>
pub fn bip39( mnemonic: &Mnemonic, password: &str, algorithm: Algorithm, ) -> Result<Self>
Derives a master key and chain code from a mnemonic using BIP39.
Sourcepub fn substrate(
mnemonic: &Mnemonic,
password: &str,
algorithm: Algorithm,
) -> Result<Self>
pub fn substrate( mnemonic: &Mnemonic, password: &str, algorithm: Algorithm, ) -> Result<Self>
Derives a master key and chain code from a mnemonic. This avoids the complex BIP39 seed generation algorithm which was intended to support brain wallets. Instead it uses pbkdf2 using the entropy as the key and password as the salt.
Sourcepub fn secret_key(&self) -> &SecretKey
pub fn secret_key(&self) -> &SecretKey
The secret key used to sign messages.
Sourcepub fn chain_code(&self) -> &[u8; 32]
pub fn chain_code(&self) -> &[u8; 32]
The chain code used to derive child keys.
Sourcepub fn public_key(&self) -> DerivedPublicKey
pub fn public_key(&self) -> DerivedPublicKey
Returns the derived public key used for verifying signatures.
Sourcepub fn derive(&self, child: ChildNumber) -> Result<Self>
pub fn derive(&self, child: ChildNumber) -> Result<Self>
Derives a child secret key.
Trait Implementations§
Source§impl Clone for DerivedSecretKey
impl Clone for DerivedSecretKey
Source§fn clone(&self) -> DerivedSecretKey
fn clone(&self) -> DerivedSecretKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DerivedSecretKey
impl RefUnwindSafe for DerivedSecretKey
impl Send for DerivedSecretKey
impl Sync for DerivedSecretKey
impl Unpin for DerivedSecretKey
impl UnwindSafe for DerivedSecretKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more