Enum bdk::keys::ExtendedKey
source · pub enum ExtendedKey<Ctx: ScriptContext = Legacy> {
Private((Xpriv, PhantomData<Ctx>)),
Public((Xpub, PhantomData<Ctx>)),
}
Expand description
Enum for extended keys that can be either xprv
or xpub
An instance of ExtendedKey
can be constructed from an Xpriv
or an Xpub
by using the From
trait.
Defaults to the Legacy
context.
Variants§
Private((Xpriv, PhantomData<Ctx>))
A private extended key, aka an xprv
Public((Xpub, PhantomData<Ctx>))
A public extended key, aka an xpub
Implementations§
source§impl<Ctx: ScriptContext> ExtendedKey<Ctx>
impl<Ctx: ScriptContext> ExtendedKey<Ctx>
sourcepub fn has_secret(&self) -> bool
pub fn has_secret(&self) -> bool
Return whether or not the key contains the private data
sourcepub fn into_xprv(self, network: Network) -> Option<Xpriv>
pub fn into_xprv(self, network: Network) -> Option<Xpriv>
Transform the ExtendedKey
into an Xpriv
for the
given [Network
], if the key contains the private data
sourcepub fn into_xpub<C: Signing>(self, network: Network, secp: &Secp256k1<C>) -> Xpub
pub fn into_xpub<C: Signing>(self, network: Network, secp: &Secp256k1<C>) -> Xpub
Transform the ExtendedKey
into an Xpub
for the
given [Network
]
Trait Implementations§
source§impl<Ctx: ScriptContext> DerivableKey<Ctx> for ExtendedKey<Ctx>
impl<Ctx: ScriptContext> DerivableKey<Ctx> for ExtendedKey<Ctx>
Identity conversion
source§fn into_extended_key(self) -> Result<ExtendedKey<Ctx>, KeyError>
fn into_extended_key(self) -> Result<ExtendedKey<Ctx>, KeyError>
Consume
self
and turn it into an ExtendedKey
source§fn into_descriptor_key(
self,
origin: Option<KeySource>,
derivation_path: DerivationPath
) -> Result<DescriptorKey<Ctx>, KeyError>
fn into_descriptor_key(
self,
origin: Option<KeySource>,
derivation_path: DerivationPath
) -> Result<DescriptorKey<Ctx>, KeyError>
Consume
self
and turn it into a DescriptorKey
by adding the extra metadata, such as
key origin and derivation path Read more