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>

source

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.

source

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>

source

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 ChainCodes or ExtendedKeys 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>

source§

fn clone(&self) -> ExtendedKey<K>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<K: Debug> Debug for ExtendedKey<K>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<K: Hash> Hash for ExtendedKey<K>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<K: PartialEq> PartialEq<ExtendedKey<K>> for ExtendedKey<K>

source§

fn eq(&self, other: &ExtendedKey<K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<K: Copy> Copy for ExtendedKey<K>

source§

impl<K: Eq> Eq for ExtendedKey<K>

source§

impl<K> StructuralEq for ExtendedKey<K>

source§

impl<K> StructuralPartialEq for ExtendedKey<K>

Auto Trait Implementations§

§

impl<K> RefUnwindSafe for ExtendedKey<K>where K: RefUnwindSafe,

§

impl<K> Send for ExtendedKey<K>where K: Send,

§

impl<K> Sync for ExtendedKey<K>where K: Sync,

§

impl<K> Unpin for ExtendedKey<K>where K: Unpin,

§

impl<K> UnwindSafe for ExtendedKey<K>where K: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V