From 9be8e7410751f47e8b5d2ab90945a7618482bd0e Mon Sep 17 00:00:00 2001 From: Dominik Spicher Date: Thu, 10 Mar 2022 15:57:29 +0100 Subject: [PATCH 1/2] Allow SharedSecret to be created from byte array This was accidentally removed in 8b2edad. See also the discussion on https://github.com/rust-bitcoin/rust-secp256k1/pull/402 --- src/ecdh.rs | 5 +++++ 1 file changed, 5 insertions(+) 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 { From 463148f9a0a316c5f2cf5cb89078ed59d87dfdf6 Mon Sep 17 00:00:00 2001 From: Dominik Spicher Date: Thu, 10 Mar 2022 16:29:13 +0100 Subject: [PATCH 2/2] bump version to 0.22.1 --- CHANGELOG.md | 4 ++++ Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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"