Merge rust-bitcoin/rust-secp256k1#417: Allow SharedSecret to be created from byte array

463148f9a0 bump version to 0.22.1 (Dominik Spicher)
9be8e74107 Allow SharedSecret to be created from byte array (Dominik Spicher)

Pull request description:

  This was accidentally removed in 8b2edad. See also the discussion
  on https://github.com/rust-bitcoin/rust-secp256k1/pull/402

  Closes #416.

ACKs for top commit:
  apoelstra:
    ACK 463148f9a0

Tree-SHA512: 04e16226efa2cf6fd461eabb0c78e5b00f347c78e20c1c7561591ffa74a7259fb3265b49a9d7326caf70e4d5ce32a620485f1bd5538c292654f91eb68c2a57dc
This commit is contained in:
Andrew Poelstra 2022-03-11 17:39:57 +00:00
commit 330c91b2be
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 10 additions and 1 deletions

View File

@ -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)

View File

@ -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"

View File

@ -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 {