From df3297c34ecf01a78f31c428b05ae2b4883c914d Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Mon, 28 Mar 2022 21:27:51 +0200 Subject: [PATCH 1/2] Implement derives for TweakedKeyPair --- src/util/schnorr.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/util/schnorr.rs b/src/util/schnorr.rs index 535abb98..b5bbe0f8 100644 --- a/src/util/schnorr.rs +++ b/src/util/schnorr.rs @@ -60,9 +60,8 @@ impl fmt::Display for TweakedPublicKey { pub type UntweakedKeyPair = ::KeyPair; /// Tweaked BIP-340 key pair -#[derive(Clone)] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "std", derive(Debug))] -// TODO: Add other derives once secp256k1 v0.21.3 released pub struct TweakedKeyPair(::KeyPair); /// A trait for tweaking BIP340 key types (x-only public keys and key pairs). From 174a99cd06a26d3ca6499a95e44e97f400c12362 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Mon, 28 Mar 2022 21:29:04 +0200 Subject: [PATCH 2/2] Implement serde for TweakedKeyPair --- src/util/schnorr.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/schnorr.rs b/src/util/schnorr.rs index b5bbe0f8..8542915f 100644 --- a/src/util/schnorr.rs +++ b/src/util/schnorr.rs @@ -60,8 +60,9 @@ impl fmt::Display for TweakedPublicKey { pub type UntweakedKeyPair = ::KeyPair; /// Tweaked BIP-340 key pair -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[cfg_attr(feature = "std", derive(Debug))] +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", serde(transparent))] pub struct TweakedKeyPair(::KeyPair); /// A trait for tweaking BIP340 key types (x-only public keys and key pairs).