Struct iop_keyvault::Bip32PublicNode
source · [−]pub struct Bip32PublicNode<C: KeyDerivationCrypto + 'static> { /* private fields */ }
Expand description
In BIP-0032 a neutered extended private key is an extended public key. This struct represents such an extended public key in a given subtree. It is able to do normal (public) derivation, signature verification, creating and validating key identifiers
Implementations
sourceimpl<C: KeyDerivationCrypto + 'static> Bip32PublicNode<C>
impl<C: KeyDerivationCrypto + 'static> Bip32PublicNode<C>
sourcepub fn new(
path: Path,
xpk: <C as KeyDerivationCrypto>::ExtendedPublicKey,
subtree: &'static dyn Subtree<Suite = C>
) -> Self
pub fn new(
path: Path,
xpk: <C as KeyDerivationCrypto>::ExtendedPublicKey,
subtree: &'static dyn Subtree<Suite = C>
) -> Self
Backdoor for advanced or fringe non-standard use-cases. Use [Bip32.master
] instead for normal use-cases.
sourcepub fn xpk(&self) -> &<C as KeyDerivationCrypto>::ExtendedPublicKey
pub fn xpk(&self) -> &<C as KeyDerivationCrypto>::ExtendedPublicKey
Accessor for the extended public key of this node
sourcepub fn derive_normal(&self, idx: i32) -> Result<Bip32PublicNode<C>>
pub fn derive_normal(&self, idx: i32) -> Result<Bip32PublicNode<C>>
Create a new node with normal (public) derivation with the given index.
sourcepub fn public_key(&self) -> C::PublicKey
pub fn public_key(&self) -> C::PublicKey
Creates the public key that belongs to this node for verifying authentications done by the corresponding private key.
sourcepub fn key_id(&self) -> C::KeyId
pub fn key_id(&self) -> C::KeyId
Creates the key identifier for the public key. This is an extra layer of security for single-use keys, so the revealing of the public key can be delayed to the point when the authenticated action (spending some coin or revoking access) makes the public key irrelevant after the action is successful.
sourceimpl Bip32PublicNode<Secp256k1>
impl Bip32PublicNode<Secp256k1>
sourcepub fn from_xpub(
path: Path,
xpub: impl AsRef<str>,
network: &'static dyn Network<Suite = Secp256k1>
) -> Result<Bip32PublicNode<Secp256k1>>
pub fn from_xpub(
path: Path,
xpub: impl AsRef<str>,
network: &'static dyn Network<Suite = Secp256k1>
) -> Result<Bip32PublicNode<Secp256k1>>
Recreates the BIP32 public node from its parts
sourcepub fn to_xpub(
&self,
network: &'static dyn Network<Suite = Secp256k1>
) -> String
pub fn to_xpub(
&self,
network: &'static dyn Network<Suite = Secp256k1>
) -> String
Returns the extended public key in the BIP32 readable format with the version bytes of the network.
sourcepub fn to_p2pkh_addr(
&self,
network: &'static dyn Network<Suite = Secp256k1>
) -> String
pub fn to_p2pkh_addr(
&self,
network: &'static dyn Network<Suite = Secp256k1>
) -> String
Returns the P2PKH address that belongs to this node using the version byte of the network.
Trait Implementations
sourceimpl<C: Clone + KeyDerivationCrypto + 'static> Clone for Bip32PublicNode<C>
impl<C: Clone + KeyDerivationCrypto + 'static> Clone for Bip32PublicNode<C>
sourcefn clone(&self) -> Bip32PublicNode<C>
fn clone(&self) -> Bip32PublicNode<C>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl<C> !RefUnwindSafe for Bip32PublicNode<C>
impl<C> !Send for Bip32PublicNode<C>
impl<C> !Sync for Bip32PublicNode<C>
impl<C> Unpin for Bip32PublicNode<C> where
<C as KeyDerivationCrypto>::ExtendedPublicKey: Unpin,
impl<C> !UnwindSafe for Bip32PublicNode<C>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more