Skip to content

Commit ede0d08

Browse files
committed
Add From implementations
1 parent dd11fa4 commit ede0d08

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/schnorr.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,27 @@ impl TweakedKeyPair {
181181
}
182182
}
183183

184+
impl From<TweakedPublicKey> for XOnlyPublicKey {
185+
#[inline]
186+
fn from(pair: TweakedPublicKey) -> Self {
187+
pair.0
188+
}
189+
}
190+
191+
impl From<TweakedKeyPair> for KeyPair {
192+
#[inline]
193+
fn from(pair: TweakedKeyPair) -> Self {
194+
pair.0
195+
}
196+
}
197+
198+
impl From<TweakedKeyPair> for TweakedPublicKey {
199+
#[inline]
200+
fn from(pair: TweakedKeyPair) -> Self {
201+
TweakedPublicKey::from_keypair(pair)
202+
}
203+
}
204+
184205
/// A BIP340-341 serialized schnorr signature with the corresponding hash type.
185206
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
186207
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "actual_serde"))]

0 commit comments

Comments
 (0)