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 #402
  • Loading branch information
dspicher committed Mar 10, 2022
1 parent 39e47fb commit 9be8e74
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ecdh.rs
Original file line number Diff line number Diff line change
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 9be8e74

Please sign in to comment.