Skip to content

Commit fc269ee

Browse files
committed
Rename secret_bytes to to_secret_bytes
As we did elsewhere add a new function and deprecate the old one. Done for the two places we missed: - `ecdh::SharedSecret` - `Keypair` Close: #845
1 parent 155c7c1 commit fc269ee

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/ecdh.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ impl SharedSecret {
5555

5656
/// Returns the shared secret as a byte value.
5757
#[inline]
58-
pub fn secret_bytes(&self) -> [u8; SHARED_SECRET_SIZE] { self.0 }
58+
pub fn to_secret_bytes(&self) -> [u8; SHARED_SECRET_SIZE] { self.0 }
59+
60+
/// Returns the shared secret as a byte value.
61+
#[deprecated(since = "TBD", note = "Use `to_secret_bytes` instead.")]
62+
#[inline]
63+
pub fn secret_bytes(&self) -> [u8; SHARED_SECRET_SIZE] { self.to_secret_bytes() }
5964

6065
/// Creates a shared secret from `bytes` array.
6166
#[inline]

src/key/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,15 @@ impl Keypair {
612612

613613
/// Returns the secret bytes for this key pair.
614614
#[inline]
615-
pub fn secret_bytes(&self) -> [u8; constants::SECRET_KEY_SIZE] {
615+
pub fn to_secret_bytes(&self) -> [u8; constants::SECRET_KEY_SIZE] {
616616
*SecretKey::from_keypair(self).as_ref()
617617
}
618618

619+
/// Returns the secret bytes for this key pair.
620+
#[deprecated(since = "TBD", note = "use to_secret_bytes instead")]
621+
#[inline]
622+
pub fn secret_bytes(&self) -> [u8; constants::SECRET_KEY_SIZE] { self.to_secret_bytes() }
623+
619624
/// Tweaks a keypair by first converting the public key to an xonly key and tweaking it.
620625
///
621626
/// # Errors

0 commit comments

Comments
 (0)