Struct schnorrkel::derive::ExtendedKey
source · pub struct ExtendedKey<K> {
pub key: K,
pub chaincode: ChainCode,
}
Expand description
A convenience wraper that combines derivable key and a chain code.
Fields§
§key: K
Appropriate key type
chaincode: ChainCode
We cannot assume the original public key is secret and additional
inputs might have low entropy, like i
in BIP32. As in BIP32,
chain codes fill this gap by being a high entropy secret shared
between public and private key holders. These are produced by
key derivations and can be incorporated into subsequence key
derivations.
Implementations§
source§impl<K: Derivation> ExtendedKey<K>
impl<K: Derivation> ExtendedKey<K>
sourcepub fn derived_key<T>(&self, t: T) -> ExtendedKey<K>where
T: SigningTranscript,
pub fn derived_key<T>(&self, t: T) -> ExtendedKey<K>where T: SigningTranscript,
Derive key with subkey identified by a byte array presented as a hash, and a chain code.
sourcepub fn derived_key_simple<B: AsRef<[u8]>>(&self, i: B) -> ExtendedKey<K>
pub fn derived_key_simple<B: AsRef<[u8]>>(&self, i: B) -> ExtendedKey<K>
Derive key with subkey identified by a byte array and a chain code in the extended key.
source§impl ExtendedKey<SecretKey>
impl ExtendedKey<SecretKey>
sourcepub fn hard_derive_mini_secret_key<B: AsRef<[u8]>>(
&self,
i: B,
mode: ExpansionMode
) -> ExtendedKey<SecretKey>
pub fn hard_derive_mini_secret_key<B: AsRef<[u8]>>( &self, i: B, mode: ExpansionMode ) -> ExtendedKey<SecretKey>
Vaguely BIP32-like “hard” derivation of a MiniSecretKey
from a SecretKey
We do not envision any “good reasons” why these “hard”
derivations should ever be used after the soft Derivation
trait. We similarly do not believe hard derivations
make any sense for ChainCode
s or ExtendedKey
s types.
Yet, some existing BIP32 workflows might do these things,
due to BIP32’s de facto stnadardization and poor design.
In consequence, we provide this method to do “hard” derivations
in a way that should work with all BIP32 workflows and any
permissible mutations of SecretKey
. This means only that
we hash the SecretKey
’s scalar, but not its nonce becuase
the secret key remains valid if the nonce is changed.
Trait Implementations§
source§impl<K: Clone> Clone for ExtendedKey<K>
impl<K: Clone> Clone for ExtendedKey<K>
source§fn clone(&self) -> ExtendedKey<K>
fn clone(&self) -> ExtendedKey<K>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<K: Debug> Debug for ExtendedKey<K>
impl<K: Debug> Debug for ExtendedKey<K>
source§impl<K: Hash> Hash for ExtendedKey<K>
impl<K: Hash> Hash for ExtendedKey<K>
source§impl<K: PartialEq> PartialEq<ExtendedKey<K>> for ExtendedKey<K>
impl<K: PartialEq> PartialEq<ExtendedKey<K>> for ExtendedKey<K>
source§fn eq(&self, other: &ExtendedKey<K>) -> bool
fn eq(&self, other: &ExtendedKey<K>) -> bool
self
and other
values to be equal, and is used
by ==
.