Struct nostr_sdk::bitcoin::bip32::ExtendedPrivKey
pub struct ExtendedPrivKey {
pub network: Network,
pub depth: u8,
pub parent_fingerprint: Fingerprint,
pub child_number: ChildNumber,
pub private_key: SecretKey,
pub chain_code: ChainCode,
}Expand description
Extended private key
Fields§
§network: NetworkThe network this key is to be used on
depth: u8How many derivations this key is from the master (which is 0)
parent_fingerprint: FingerprintFingerprint of the parent key (0 for master)
child_number: ChildNumberChild number of the key used to derive from parent (0 for master)
private_key: SecretKeyPrivate key
chain_code: ChainCodeChain code
Implementations§
§impl ExtendedPrivKey
impl ExtendedPrivKey
pub fn new_master(
network: Network,
seed: &[u8]
) -> Result<ExtendedPrivKey, Error>
pub fn new_master( network: Network, seed: &[u8] ) -> Result<ExtendedPrivKey, Error>
Construct a new master key from a seed value
pub fn to_priv(self) -> PrivateKey
pub fn to_priv(self) -> PrivateKey
Constructs ECDSA compressed private key matching internal secret key representation.
pub fn to_keypair<C>(self, secp: &Secp256k1<C>) -> KeyPairwhere
C: Signing,
pub fn to_keypair<C>(self, secp: &Secp256k1<C>) -> KeyPairwhere C: Signing,
Constructs BIP340 keypair for Schnorr signatures and Taproot use matching the internal secret key representation.
pub fn derive_priv<C, P>(
&self,
secp: &Secp256k1<C>,
path: &P
) -> Result<ExtendedPrivKey, Error>where
C: Signing,
P: AsRef<[ChildNumber]>,
pub fn derive_priv<C, P>( &self, secp: &Secp256k1<C>, path: &P ) -> Result<ExtendedPrivKey, Error>where C: Signing, P: AsRef<[ChildNumber]>,
Attempts to derive an extended private key from a path.
The path argument can be both of type DerivationPath or Vec<ChildNumber>.
pub fn ckd_priv<C>(
&self,
secp: &Secp256k1<C>,
i: ChildNumber
) -> Result<ExtendedPrivKey, Error>where
C: Signing,
pub fn ckd_priv<C>( &self, secp: &Secp256k1<C>, i: ChildNumber ) -> Result<ExtendedPrivKey, Error>where C: Signing,
Private->Private child key derivation
pub fn decode(data: &[u8]) -> Result<ExtendedPrivKey, Error>
pub fn decode(data: &[u8]) -> Result<ExtendedPrivKey, Error>
Decoding extended private key from binary data according to BIP 32
pub fn identifier<C>(&self, secp: &Secp256k1<C>) -> XpubIdentifierwhere
C: Signing,
pub fn identifier<C>(&self, secp: &Secp256k1<C>) -> XpubIdentifierwhere C: Signing,
Returns the HASH160 of the public key belonging to the xpriv
pub fn fingerprint<C>(&self, secp: &Secp256k1<C>) -> Fingerprintwhere
C: Signing,
pub fn fingerprint<C>(&self, secp: &Secp256k1<C>) -> Fingerprintwhere C: Signing,
Returns the first four bytes of the identifier
Trait Implementations§
§impl Clone for ExtendedPrivKey
impl Clone for ExtendedPrivKey
§fn clone(&self) -> ExtendedPrivKey
fn clone(&self) -> ExtendedPrivKey
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ExtendedPrivKey
impl Debug for ExtendedPrivKey
§impl Display for ExtendedPrivKey
impl Display for ExtendedPrivKey
§impl FromStr for ExtendedPrivKey
impl FromStr for ExtendedPrivKey
§impl GetKey for ExtendedPrivKey
impl GetKey for ExtendedPrivKey
§type Error = GetKeyError
type Error = GetKeyError
§fn get_key<C>(
&self,
key_request: KeyRequest,
secp: &Secp256k1<C>
) -> Result<Option<PrivateKey>, <ExtendedPrivKey as GetKey>::Error>where
C: Signing,
fn get_key<C>( &self, key_request: KeyRequest, secp: &Secp256k1<C> ) -> Result<Option<PrivateKey>, <ExtendedPrivKey as GetKey>::Error>where C: Signing,
key_request. Read more§impl PartialEq<ExtendedPrivKey> for ExtendedPrivKey
impl PartialEq<ExtendedPrivKey> for ExtendedPrivKey
§fn eq(&self, other: &ExtendedPrivKey) -> bool
fn eq(&self, other: &ExtendedPrivKey) -> bool
self and other values to be equal, and is used
by ==.impl Copy for ExtendedPrivKey
impl Eq for ExtendedPrivKey
impl StructuralEq for ExtendedPrivKey
impl StructuralPartialEq for ExtendedPrivKey
Auto Trait Implementations§
impl RefUnwindSafe for ExtendedPrivKey
impl Send for ExtendedPrivKey
impl Sync for ExtendedPrivKey
impl Unpin for ExtendedPrivKey
impl UnwindSafe for ExtendedPrivKey
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.