pub struct ExtendedPrivateKey<K: PrivateKey> { /* private fields */ }
Expand description
Extended private keys derived using BIP32.
Generic around a PrivateKey
type. When the secp256k1
feature of this
crate is enabled, the XPrv
type provides a convenient alias for
extended ECDSA/secp256k1 private keys.
Implementations§
Source§impl<K> ExtendedPrivateKey<K>where
K: PrivateKey,
impl<K> ExtendedPrivateKey<K>where
K: PrivateKey,
Sourcepub fn derive_from_path<S>(seed: S, path: &DerivationPath) -> Result<Self>
Available on crate feature alloc
only.
pub fn derive_from_path<S>(seed: S, path: &DerivationPath) -> Result<Self>
alloc
only.Derive a child key from the given DerivationPath
.
Sourcepub fn derive_child(&self, child_number: ChildNumber) -> Result<Self>
pub fn derive_child(&self, child_number: ChildNumber) -> Result<Self>
Derive a child key for a particular ChildNumber
.
Sourcepub fn private_key(&self) -> &K
pub fn private_key(&self) -> &K
Borrow the derived private key value.
Sourcepub fn public_key(&self) -> ExtendedPublicKey<K::PublicKey>
pub fn public_key(&self) -> ExtendedPublicKey<K::PublicKey>
Serialize the derived public key as bytes.
Sourcepub fn attrs(&self) -> &ExtendedKeyAttrs
pub fn attrs(&self) -> &ExtendedKeyAttrs
Get attributes for this key such as depth, parent fingerprint, child number, and chain code.
Sourcepub fn to_bytes(&self) -> PrivateKeyBytes
pub fn to_bytes(&self) -> PrivateKeyBytes
Serialize the raw private key as a byte array.
Sourcepub fn to_extended_key(&self, prefix: Prefix) -> ExtendedKey
pub fn to_extended_key(&self, prefix: Prefix) -> ExtendedKey
Serialize this key as an ExtendedKey
.
Trait Implementations§
Source§impl<K: Clone + PrivateKey> Clone for ExtendedPrivateKey<K>
impl<K: Clone + PrivateKey> Clone for ExtendedPrivateKey<K>
Source§fn clone(&self) -> ExtendedPrivateKey<K>
fn clone(&self) -> ExtendedPrivateKey<K>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<K> ConstantTimeEq for ExtendedPrivateKey<K>where
K: PrivateKey,
impl<K> ConstantTimeEq for ExtendedPrivateKey<K>where
K: PrivateKey,
Source§impl<K> Debug for ExtendedPrivateKey<K>where
K: PrivateKey,
impl<K> Debug for ExtendedPrivateKey<K>where
K: PrivateKey,
Source§impl<K> From<&ExtendedPrivateKey<K>> for ExtendedPublicKey<K::PublicKey>where
K: PrivateKey,
impl<K> From<&ExtendedPrivateKey<K>> for ExtendedPublicKey<K::PublicKey>where
K: PrivateKey,
Source§fn from(xprv: &ExtendedPrivateKey<K>) -> ExtendedPublicKey<K::PublicKey>
fn from(xprv: &ExtendedPrivateKey<K>) -> ExtendedPublicKey<K::PublicKey>
Converts to this type from the input type.
Source§impl From<&ExtendedPrivateKey<SigningKey<Secp256k1>>> for SigningKey
Available on crate feature secp256k1
only.
impl From<&ExtendedPrivateKey<SigningKey<Secp256k1>>> for SigningKey
Available on crate feature
secp256k1
only.Source§fn from(xprv: &XPrv) -> SigningKey
fn from(xprv: &XPrv) -> SigningKey
Converts to this type from the input type.
Source§impl From<ExtendedPrivateKey<SigningKey<Secp256k1>>> for SigningKey
Available on crate feature secp256k1
only.
impl From<ExtendedPrivateKey<SigningKey<Secp256k1>>> for SigningKey
Available on crate feature
secp256k1
only.Source§fn from(xprv: XPrv) -> SigningKey
fn from(xprv: XPrv) -> SigningKey
Converts to this type from the input type.
Source§impl<K> FromStr for ExtendedPrivateKey<K>where
K: PrivateKey,
impl<K> FromStr for ExtendedPrivateKey<K>where
K: PrivateKey,
Source§impl<K> PartialEq for ExtendedPrivateKey<K>where
K: PrivateKey,
NOTE: uses ConstantTimeEq
internally
impl<K> PartialEq for ExtendedPrivateKey<K>where
K: PrivateKey,
NOTE: uses ConstantTimeEq
internally
Source§impl<K> TryFrom<ExtendedKey> for ExtendedPrivateKey<K>where
K: PrivateKey,
impl<K> TryFrom<ExtendedKey> for ExtendedPrivateKey<K>where
K: PrivateKey,
Source§fn try_from(extended_key: ExtendedKey) -> Result<ExtendedPrivateKey<K>>
fn try_from(extended_key: ExtendedKey) -> Result<ExtendedPrivateKey<K>>
Performs the conversion.
impl<K> Eq for ExtendedPrivateKey<K>where
K: PrivateKey,
NOTE: uses ConstantTimeEq
internally
Auto Trait Implementations§
impl<K> Freeze for ExtendedPrivateKey<K>where
K: Freeze,
impl<K> RefUnwindSafe for ExtendedPrivateKey<K>where
K: RefUnwindSafe,
impl<K> Send for ExtendedPrivateKey<K>where
K: Send,
impl<K> Sync for ExtendedPrivateKey<K>where
K: Sync,
impl<K> Unpin for ExtendedPrivateKey<K>where
K: Unpin,
impl<K> UnwindSafe for ExtendedPrivateKey<K>where
K: UnwindSafe,
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