From dc17be42b5ee6b50bfacb26524fd5637d368d1cc Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 11 Sep 2025 14:35:17 +1000 Subject: [PATCH] Delete deprecated code I don't know the exact policy here in this repo but following along from `rust-bitcoin` delete all deprecated code from at least 2 releases ago - assuming the next release is going to be `v0.32.0`. --- src/ecdsa/mod.rs | 13 ------------- src/ecdsa/recovery.rs | 13 ------------- src/ellswift.rs | 28 ---------------------------- src/key/mod.rs | 39 --------------------------------------- src/lib.rs | 35 ----------------------------------- 5 files changed, 128 deletions(-) diff --git a/src/ecdsa/mod.rs b/src/ecdsa/mod.rs index 12072f8ac..76ef79508 100644 --- a/src/ecdsa/mod.rs +++ b/src/ecdsa/mod.rs @@ -145,19 +145,6 @@ impl Signature { } } - /// Obtains a raw pointer suitable for use with FFI functions - #[inline] - #[deprecated(since = "0.25.0", note = "Use Self::as_c_ptr if you need to access the FFI layer")] - pub fn as_ptr(&self) -> *const ffi::Signature { self.as_c_ptr() } - - /// Obtains a raw mutable pointer suitable for use with FFI functions - #[inline] - #[deprecated( - since = "0.25.0", - note = "Use Self::as_mut_c_ptr if you need to access the FFI layer" - )] - pub fn as_mut_ptr(&mut self) -> *mut ffi::Signature { self.as_mut_c_ptr() } - #[inline] /// Serializes the signature in DER format pub fn serialize_der(&self) -> SerializedSignature { diff --git a/src/ecdsa/recovery.rs b/src/ecdsa/recovery.rs index de674bd76..6021cabea 100644 --- a/src/ecdsa/recovery.rs +++ b/src/ecdsa/recovery.rs @@ -92,19 +92,6 @@ impl RecoverableSignature { } } - /// Obtains a raw pointer suitable for use with FFI functions. - #[inline] - #[deprecated(since = "0.25.0", note = "Use Self::as_c_ptr if you need to access the FFI layer")] - pub fn as_ptr(&self) -> *const ffi::RecoverableSignature { self.as_c_ptr() } - - /// Obtains a raw mutable pointer suitable for use with FFI functions. - #[inline] - #[deprecated( - since = "0.25.0", - note = "Use Self::as_mut_c_ptr if you need to access the FFI layer" - )] - pub fn as_mut_ptr(&mut self) -> *mut ffi::RecoverableSignature { self.as_mut_c_ptr() } - #[inline] /// Serializes the recoverable signature in compact format. pub fn serialize_compact(&self) -> (RecoveryId, [u8; 64]) { diff --git a/src/ellswift.rs b/src/ellswift.rs index fe640b779..3ee417907 100644 --- a/src/ellswift.rs +++ b/src/ellswift.rs @@ -282,24 +282,6 @@ impl ElligatorSwiftSharedSecret { pub const fn as_secret_bytes(&self) -> &[u8; 32] { &self.0 } } -/// Represents which party we are in the ECDH. -/// -/// Here `A` is the initiator and `B` is the responder. -/// -/// this context, "we" means the party that possesses the secret key passed to -/// [`ElligatorSwift::shared_secret`]. -/// -/// This distinction is important because the different parties compute different -/// hashes of the shared secret. -#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[deprecated(since = "0.30.0", note = "Use `Party` instead.")] -pub enum ElligatorSwiftParty { - /// We are the initiator of the ECDH - A, - /// We are the responder of the ECDH - B, -} - /// Represents the two parties in ECDH #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Party { @@ -309,16 +291,6 @@ pub enum Party { Responder, } -#[allow(deprecated)] -impl From for Party { - fn from(value: ElligatorSwiftParty) -> Self { - match value { - ElligatorSwiftParty::A => Party::Initiator, - ElligatorSwiftParty::B => Party::Responder, - } - } -} - impl Party { fn to_ffi_int(self) -> c_int { match self { diff --git a/src/key/mod.rs b/src/key/mod.rs index 36cfc8b6e..7c2862906 100644 --- a/src/key/mod.rs +++ b/src/key/mod.rs @@ -89,19 +89,6 @@ impl str::FromStr for PublicKey { } impl PublicKey { - /// Obtains a raw const pointer suitable for use with FFI functions. - #[inline] - #[deprecated(since = "0.25.0", note = "Use Self::as_c_ptr if you need to access the FFI layer")] - pub fn as_ptr(&self) -> *const ffi::PublicKey { self.as_c_ptr() } - - /// Obtains a raw mutable pointer suitable for use with FFI functions. - #[inline] - #[deprecated( - since = "0.25.0", - note = "Use Self::as_mut_c_ptr if you need to access the FFI layer" - )] - pub fn as_mut_ptr(&mut self) -> *mut ffi::PublicKey { self.as_mut_c_ptr() } - /// Creates a new public key from a [`SecretKey`]. /// /// # Examples @@ -505,19 +492,6 @@ pub struct Keypair(ffi::Keypair); impl_fast_comparisons!(Keypair); impl Keypair { - /// Obtains a raw const pointer suitable for use with FFI functions. - #[inline] - #[deprecated(since = "0.25.0", note = "Use Self::as_c_ptr if you need to access the FFI layer")] - pub fn as_ptr(&self) -> *const ffi::Keypair { self.as_c_ptr() } - - /// Obtains a raw mutable pointer suitable for use with FFI functions. - #[inline] - #[deprecated( - since = "0.25.0", - note = "Use Self::as_mut_c_ptr if you need to access the FFI layer" - )] - pub fn as_mut_ptr(&mut self) -> *mut ffi::Keypair { self.as_mut_c_ptr() } - /// Creates a [`Keypair`] directly from a Secp256k1 secret key. #[inline] pub fn from_secret_key(secp: &Secp256k1, sk: &SecretKey) -> Keypair { @@ -867,19 +841,6 @@ impl str::FromStr for XOnlyPublicKey { } impl XOnlyPublicKey { - /// Obtains a raw const pointer suitable for use with FFI functions. - #[inline] - #[deprecated(since = "0.25.0", note = "Use Self::as_c_ptr if you need to access the FFI layer")] - pub fn as_ptr(&self) -> *const ffi::XOnlyPublicKey { self.as_c_ptr() } - - /// Obtains a raw mutable pointer suitable for use with FFI functions. - #[inline] - #[deprecated( - since = "0.25.0", - note = "Use Self::as_mut_c_ptr if you need to access the FFI layer" - )] - pub fn as_mut_ptr(&mut self) -> *mut ffi::XOnlyPublicKey { self.as_mut_c_ptr() } - /// Returns the [`XOnlyPublicKey`] (and its [`Parity`]) for `keypair`. #[inline] pub fn from_keypair(keypair: &Keypair) -> (XOnlyPublicKey, Parity) { diff --git a/src/lib.rs b/src/lib.rs index ee0fe5a98..cb3dc83f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -204,22 +204,6 @@ use crate::ffi::CPtr; pub use crate::key::{InvalidParityValue, Keypair, Parity, PublicKey, SecretKey, XOnlyPublicKey}; pub use crate::scalar::Scalar; -/// Trait describing something that promises to be a 32-byte uniformly random number. -/// -/// In particular, anything implementing this trait must have negligible probability -/// of being zero, overflowing the group order, or equalling any specific value. -/// -/// Since version 0.29 this has been deprecated; users should instead implement -/// `Into` for types that satisfy these properties. -#[deprecated( - since = "0.29.0", - note = "Please see v0.29.0 rust-secp256k1/CHANGELOG.md for suggestion" -)] -pub trait ThirtyTwoByteHash { - /// Converts the object into a 32-byte array - fn into_32(self) -> [u8; 32]; -} - /// A (hashed) message input to an ECDSA signature. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Message([u8; constants::MESSAGE_SIZE]); @@ -227,19 +211,6 @@ impl_array_newtype!(Message, u8, constants::MESSAGE_SIZE); impl_pretty_debug!(Message); impl Message { - /// Creates a [`Message`] from a 32 byte slice `digest`. - /// - /// Converts a `MESSAGE_SIZE`-byte slice to a message object. **WARNING:** the slice has to be a - /// cryptographically secure hash of the actual message that's going to be signed. Otherwise - /// the result of signing isn't a - /// [secure signature](https://twitter.com/pwuille/status/1063582706288586752). - #[inline] - #[deprecated(since = "0.28.0", note = "use from_digest instead")] - pub fn from_slice(digest: &[u8]) -> Result { - #[allow(deprecated)] - Message::from_digest_slice(digest) - } - /// Creates a [`Message`] from a `digest`. /// /// The `digest` array has to be a cryptographically secure hash of the actual message that's @@ -271,12 +242,6 @@ impl Message { } } -#[allow(deprecated)] -impl From for Message { - /// Converts a 32-byte hash directly to a message without error paths. - fn from(t: T) -> Message { Message(t.into_32()) } -} - impl fmt::LowerHex for Message { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for byte in self.0.iter() {