Struct coins_bip32::xkeys::XPriv
source · pub struct XPriv { /* private fields */ }
Expand description
A BIP32 eXtended Privkey
Implementations§
source§impl XPriv
impl XPriv
sourcepub fn sign_digest_recoverable<D>(
&self,
digest: D,
) -> Result<(Signature, RecoveryId), Error>
pub fn sign_digest_recoverable<D>( &self, digest: D, ) -> Result<(Signature, RecoveryId), Error>
Sign the given message digest, returning a signature and recovery ID. See ECDSA docs here
source§impl XPriv
impl XPriv
sourcepub const fn new(key: SigningKey, xkey_info: XKeyInfo) -> Self
pub const fn new(key: SigningKey, xkey_info: XKeyInfo) -> Self
Instantiate a new XPriv.
sourcepub fn verify_key(&self) -> XPub
pub fn verify_key(&self) -> XPub
Derive the associated XPub
sourcepub fn fingerprint(&self) -> KeyFingerprint
pub fn fingerprint(&self) -> KeyFingerprint
The fingerprint is the first 4 bytes of the HASH160 of the public key
sourcepub fn root_node(
hmac_key: &[u8],
data: &[u8],
hint: Option<Hint>,
) -> Result<XPriv, Bip32Error>
pub fn root_node( hmac_key: &[u8], data: &[u8], hint: Option<Hint>, ) -> Result<XPriv, Bip32Error>
Generate a customized root node
sourcepub fn root_from_seed(
data: &[u8],
hint: Option<Hint>,
) -> Result<XPriv, Bip32Error>
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.
sourcepub fn custom_root_node(
hmac_key: &[u8],
data: &[u8],
hint: Option<Hint>,
) -> Result<XPriv, Bip32Error>
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.
sourcepub fn custom_root_from_seed(
data: &[u8],
hint: Option<Hint>,
) -> Result<XPriv, Bip32Error>
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.
sourcepub fn derive_path<E, P>(&self, p: P) -> Result<Self, Bip32Error>
pub fn derive_path<E, P>(&self, p: P) -> Result<Self, Bip32Error>
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
impl AsRef<SigningKey<Secp256k1>> for XPriv
source§fn as_ref(&self) -> &SigningKey
fn as_ref(&self) -> &SigningKey
Converts this type into a shared reference of the (usually inferred) input type.
source§impl AsRef<XPriv> for DerivedXPriv
impl AsRef<XPriv> for DerivedXPriv
source§impl<'de> Deserialize<'de> for XPriv
impl<'de> Deserialize<'de> for XPriv
source§fn deserialize<D>(deserializer: D) -> Result<XPriv, D::Error>where
D: Deserializer<'de>,
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 XPriv
impl<D> DigestSigner<D, (Signature<Secp256k1>, RecoveryId)> for XPriv
source§fn try_sign_digest(&self, digest: D) -> Result<(Signature, RecoveryId), Error>
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
fn sign_digest(&self, digest: D) -> S
source§impl<D> DigestSigner<D, Signature<Secp256k1>> for XPriv
impl<D> DigestSigner<D, Signature<Secp256k1>> for XPriv
source§fn try_sign_digest(&self, digest: D) -> Result<Signature, Error>
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
fn sign_digest(&self, digest: D) -> S
source§impl Parent for XPriv
impl Parent for XPriv
source§fn derive_child(&self, index: u32) -> Result<Self, Bip32Error>
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>
fn derive_path<E, P>(&self, p: P) -> Result<Self, Bip32Error>
Derive a series of child indices. Allows traversing several levels of the tree at once.
Accepts an iterator producing u32, or a string.
Auto Trait Implementations§
impl Freeze for XPriv
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> 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)