Skip to content

Commit 5443076

Browse files
committed
Merge #863: Rename secret_bytes to to_secret_bytes
fc269ee Rename secret_bytes to to_secret_bytes (Tobin C. Harding) Pull request description: 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 ACKs for top commit: apoelstra: ACK fc269ee; successfully ran local tests Tree-SHA512: a9a374978c2f5a6d37464acd3c00e5e9487f30f07987c9e69e39cf4419ce85fbc39f4c5e03d42abdec25356d143f9bfcf3944e024cd6f804a7a3afb468cee76d
2 parents 018f71f + fc269ee commit 5443076

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)