Skip to content

Commit

Permalink
Merge #417: Allow SharedSecret to be created from byte array
Browse files Browse the repository at this point in the history
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
  • Loading branch information
apoelstra committed Mar 11, 2022
2 parents 39e47fb + 463148f commit 330c91b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions 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)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "secp256k1"
version = "0.22.0"
version = "0.22.1"
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
"Andrew Poelstra <apoelstra@wpsoftware.net>" ]
license = "CC0-1.0"
Expand Down
5 changes: 5 additions & 0 deletions src/ecdh.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 330c91b

Please sign in to comment.