Add method KeyPair::public_key
Currently to get the `XOnlyPublicKey` from a `KeyPair` users must do `XOnlyPublicKey::from_keypair(&kp)`. While this does the job we can make the lib more ergonomic by providing a method directly on `KeyPair` that calls through to `XOnlyPublicKey::from_keypair`. Add method `KeyPair::public_key(&self)`.
This commit is contained in:
parent
a9cf6785cc
commit
389abddcc7
|
@ -650,6 +650,12 @@ impl KeyPair {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the [XOnlyPublicKey] for this [KeyPair].
|
||||||
|
#[inline]
|
||||||
|
pub fn public_key(&self) -> XOnlyPublicKey {
|
||||||
|
XOnlyPublicKey::from_keypair(self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<KeyPair> for SecretKey {
|
impl From<KeyPair> for SecretKey {
|
||||||
|
|
Loading…
Reference in New Issue