diff --git a/CHANGELOG.md b/CHANGELOG.md index a7a6caa68..3b38bf5af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.22.1 - 2022-03-10 + +* [Reintroduce](https://github.com/rust-bitcoin/rust-secp256k1/pull/417) accidentally removed possibility to create `SharedSecret` from byte serialization + # 0.22.0 - 2022-03-08 * Disable `bitcoin_hashes/std` by default; [add `bitcoin-hashes-std` feature to re-enable it](https://github.com/rust-bitcoin/rust-secp256k1/pull/410) diff --git a/Cargo.toml b/Cargo.toml index 36c9a8878..b870aa444 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "secp256k1" -version = "0.22.0" +version = "0.22.1" authors = [ "Dawid Ciężarkiewicz ", "Andrew Poelstra " ] license = "CC0-1.0" diff --git a/src/ecdh.rs b/src/ecdh.rs index e36553e5a..cba74913a 100644 --- a/src/ecdh.rs +++ b/src/ecdh.rs @@ -71,6 +71,11 @@ impl SharedSecret { pub fn secret_bytes(&self) -> [u8; SHARED_SECRET_SIZE] { self.0 } + + /// Creates a shared secret from a byte serialization. + pub fn from_bytes(bytes: [u8; SHARED_SECRET_SIZE]) -> SharedSecret { + SharedSecret(bytes) + } } impl Borrow<[u8]> for SharedSecret {