Struct coins_bip32::derived::DerivedXPriv

source ·
pub struct DerivedXPriv { /* private fields */ }
Expand description

An XPriv with its derivation.

Implementations§

source§

impl DerivedXPriv

source

pub fn sign_digest_recoverable<D>( &self, digest: D, ) -> Result<(Signature, RecoveryId), Error>
where D: FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update + HashMarker,

Sign the given message digest, returning a signature and recovery ID. See ECDSA docs here

source§

impl DerivedXPriv

source

pub const fn new(xpriv: XPriv, derivation: KeyDerivation) -> Self

Instantiate a derived XPub from the XPub and derivatin. This usually should not be called directly. Prefer deriving keys from parents.

source

pub fn is_private_ancestor_of( &self, other: &DerivedXPub, ) -> Result<bool, Bip32Error>

Check if this XPriv is the private ancestor of some other derived key. To check ancestry of another private key, derive its public key first

source

pub fn root_node( hmac_key: &[u8], data: &[u8], hint: Option<Hint>, ) -> Result<DerivedXPriv, Bip32Error>

Generate a customized root node using the stati

source

pub fn root_from_seed( data: &[u8], hint: Option<Hint>, ) -> Result<DerivedXPriv, Bip32Error>

Generate a root node from some seed data. Uses the BIP32-standard hmac key.

§Important:

Use a seed of AT LEAST 128 bits.

source

pub fn custom_root_node( hmac_key: &[u8], data: &[u8], hint: Option<Hint>, ) -> Result<DerivedXPriv, Bip32Error>

Instantiate a root node using a custom HMAC key.

source

pub fn custom_root_from_seed( data: &[u8], hint: Option<Hint>, ) -> Result<DerivedXPriv, Bip32Error>

Generate a root node from some seed data. Uses the BIP32-standard hmac key.

§Important:

Use a seed of AT LEAST 128 bits.

source

pub fn verify_key(&self) -> DerivedXPub

Derive the corresponding xpub

Trait Implementations§

source§

impl AsRef<SigningKey<Secp256k1>> for DerivedXPriv

source§

fn as_ref(&self) -> &SigningKey

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<XKeyInfo> for DerivedXPriv

source§

fn as_ref(&self) -> &XKeyInfo

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<XPriv> for DerivedXPriv

source§

fn as_ref(&self) -> &XPriv

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for DerivedXPriv

source§

fn clone(&self) -> DerivedXPriv

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 Debug for DerivedXPriv

source§

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

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

impl DerivedKey for DerivedXPriv

source§

fn derivation(&self) -> &KeyDerivation

Return this key’s derivation
source§

fn same_root<K: DerivedKey>(&self, other: &K) -> bool

true if the keys share a root fingerprint, false otherwise. Note that on key fingerprints, which may collide accidentally, or be intentionally collided.
source§

fn is_possible_ancestor_of<K: DerivedKey>(&self, other: &K) -> bool

true if this key is a possible ancestor of the argument, false otherwise. Read more
source§

fn path_to_descendant<K: DerivedKey>(&self, other: &K) -> Option<DerivationPath>

Returns the path to the descendant, or None if the argument is definitely not a descendant. Read more
source§

impl<'de> Deserialize<'de> for DerivedXPriv

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<D> DigestSigner<D, (Signature<Secp256k1>, RecoveryId)> for DerivedXPriv
where D: FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update + HashMarker,

source§

fn try_sign_digest(&self, digest: D) -> Result<(Signature, RecoveryId), Error>

Attempt to sign the given prehashed message Digest, returning a digital signature on success, or an error if something went wrong.
source§

fn sign_digest(&self, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl<D> DigestSigner<D, Signature<Secp256k1>> for DerivedXPriv
where D: FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update + HashMarker,

source§

fn try_sign_digest(&self, digest: D) -> Result<Signature, Error>

Attempt to sign the given prehashed message Digest, returning a digital signature on success, or an error if something went wrong.
source§

fn sign_digest(&self, digest: D) -> S

Sign the given prehashed message Digest, returning a signature. Read more
source§

impl Parent for DerivedXPriv

source§

fn derive_child(&self, index: u32) -> Result<Self, Bip32Error>

Derive the child at index. Note that this may produce the child at index+1 in rare circumstances. For public keys this will derive public children. For private keys it will derive private children.
source§

fn derive_path<E, P>(&self, p: P) -> Result<Self, Bip32Error>
where E: Into<Bip32Error>, P: TryInto<DerivationPath, Error = E>,

Derive a series of child indices. Allows traversing several levels of the tree at once. Accepts an iterator producing u32, or a string.
source§

impl Serialize for DerivedXPriv

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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 T
where 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 T
where 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,