Skip to content

Commit 330c91b

Browse files
committed
Merge #417: Allow SharedSecret to be created from byte array
463148f bump version to 0.22.1 (Dominik Spicher) 9be8e74 Allow SharedSecret to be created from byte array (Dominik Spicher) Pull request description: This was accidentally removed in 8b2edad. See also the discussion on #402 Closes #416. ACKs for top commit: apoelstra: ACK 463148f Tree-SHA512: 04e16226efa2cf6fd461eabb0c78e5b00f347c78e20c1c7561591ffa74a7259fb3265b49a9d7326caf70e4d5ce32a620485f1bd5538c292654f91eb68c2a57dc
2 parents 39e47fb + 463148f commit 330c91b

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.22.1 - 2022-03-10
2+
3+
* [Reintroduce](https://github.com/rust-bitcoin/rust-secp256k1/pull/417) accidentally removed possibility to create `SharedSecret` from byte serialization
4+
15
# 0.22.0 - 2022-03-08
26

37
* Disable `bitcoin_hashes/std` by default; [add `bitcoin-hashes-std` feature to re-enable it](https://github.com/rust-bitcoin/rust-secp256k1/pull/410)

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "secp256k1"
3-
version = "0.22.0"
3+
version = "0.22.1"
44
authors = [ "Dawid Ciężarkiewicz <[email protected]>",
55
"Andrew Poelstra <[email protected]>" ]
66
license = "CC0-1.0"

src/ecdh.rs

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ impl SharedSecret {
7171
pub fn secret_bytes(&self) -> [u8; SHARED_SECRET_SIZE] {
7272
self.0
7373
}
74+
75+
/// Creates a shared secret from a byte serialization.
76+
pub fn from_bytes(bytes: [u8; SHARED_SECRET_SIZE]) -> SharedSecret {
77+
SharedSecret(bytes)
78+
}
7479
}
7580

7681
impl Borrow<[u8]> for SharedSecret {

0 commit comments

Comments
 (0)