Add Xpriv::to_xpub

This commit is contained in:
Jiri Jakes 2024-09-14 11:20:52 +08:00
parent 5a9341bfc5
commit 0dcba98382
No known key found for this signature in database
GPG Key ID: 01F5B01A5D686F31
1 changed files with 5 additions and 0 deletions

View File

@ -602,6 +602,11 @@ impl Xpriv {
PrivateKey { compressed: true, network: self.network, inner: self.private_key }
}
/// Creates new extended public key from this extended private key.
pub fn to_xpub<C: secp256k1::Signing>(&self, secp: &Secp256k1<C>,) -> Xpub {
Xpub::from_xpriv(secp, self)
}
/// Constructs BIP340 keypair for Schnorr signatures and Taproot use matching the internal
/// secret key representation.
pub fn to_keypair<C: secp256k1::Signing>(self, secp: &Secp256k1<C>) -> Keypair {