Skip to content

Commit

Permalink
Allow SharedSecret to be created from byte array
Browse files Browse the repository at this point in the history
This was accidentally removed in 8b2edad. See also the discussion
on rust-bitcoin#402
  • Loading branch information
dspicher committed Mar 10, 2022
1 parent 39e47fb commit 30ab354
Showing 1 changed file with 5 additions and 0 deletions.
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 30ab354

Please sign in to comment.