diff --git a/Cargo.toml b/Cargo.toml index e545b2e..6f9920f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ license = "CC0-1.0" homepage = "https://github.com/rust-bitcoin/rust-secp256k1/" repository = "https://github.com/rust-bitcoin/rust-secp256k1/" documentation = "https://docs.rs/secp256k1/" -description = "Rust bindings for Pieter Wuille's `libsecp256k1` library. Implements ECDSA for the SECG elliptic curve group secp256k1 and related utilities." +description = "Rust wrapper library for Pieter Wuille's `libsecp256k1`. Implements ECDSA and BIP 340 signatures for the SECG elliptic curve group secp256k1 and related utilities." keywords = [ "crypto", "ECDSA", "secp256k1", "libsecp256k1", "bitcoin" ] readme = "README.md" autoexamples = false # Remove when edition 2018 https://github.com/rust-lang/cargo/issues/5330 diff --git a/src/schnorrsig.rs b/src/schnorrsig.rs index d8c48a0..88a3276 100644 --- a/src/schnorrsig.rs +++ b/src/schnorrsig.rs @@ -211,6 +211,12 @@ impl KeyPair { } } + /// Serialize the key pair as a secret key byte value + #[inline] + pub fn serialize_sec(&self, secp: &Secp256k1) -> [u8; constants::SECRET_KEY_SIZE] { + *SecretKey::from_keypair(secp, self).as_ref() + } + /// Tweak a keypair by adding the given tweak to the secret key and updating the /// public key accordingly. /// Will return an error if the resulting key would be invalid or if