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
This commit is contained in:
Dominik Spicher 2022-03-10 15:57:29 +01:00
parent 39e47fb645
commit 9be8e74107
1 changed files with 5 additions and 0 deletions

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 {