Struct coins_bip32::xkeys::XPriv

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

A BIP32 eXtended Privkey

Implementations§

source§

impl XPriv

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 XPriv

source

pub fn new(key: SigningKey, xkey_info: XKeyInfo) -> Self

Instantiate a new XPriv.

source

pub fn verify_key(&self) -> XPub

Derive the associated XPub

source

pub fn fingerprint(&self) -> KeyFingerprint

The fingerprint is the first 4 bytes of the HASH160 of the public key

source

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

Generate a customized root node

source

pub fn root_from_seed( data: &[u8], hint: Option<Hint> ) -> Result<XPriv, 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<XPriv, Bip32Error>

Instantiate a root node using a custom HMAC key.

source

pub fn custom_root_from_seed( data: &[u8], hint: Option<Hint> ) -> Result<XPriv, 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 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.

Trait Implementations§

source§

impl AsRef<SigningKey<Secp256k1>> for XPriv

source§

fn as_ref(&self) -> &SigningKey

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

impl AsRef<XKeyInfo> for XPriv

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 AsRef<XPriv> for XPriv

source§

fn as_ref(&self) -> &XPriv

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

impl Clone for XPriv

source§

fn clone(&self) -> Self

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 XPriv

source§

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

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

impl<'de> Deserialize<'de> for XPriv

source§

fn deserialize<D>(deserializer: D) -> Result<XPriv, 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 XPrivwhere 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.
§

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 XPrivwhere 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.
§

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

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

impl FromStr for XPriv

§

type Err = Bip32Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Parent for XPriv

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 PartialEq<XPriv> for XPriv

source§

fn eq(&self, other: &XPriv) -> 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 Serialize for XPriv

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§

§

impl RefUnwindSafe for XPriv

§

impl Send for XPriv

§

impl Sync for XPriv

§

impl Unpin for XPriv

§

impl UnwindSafe for XPriv

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