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 f78ac8c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ecdh.rs
Expand Up @@ -47,6 +47,12 @@ const SHARED_SECRET_SIZE: usize = constants::SECRET_KEY_SIZE;
pub struct SharedSecret([u8; SHARED_SECRET_SIZE]);
impl_display_secret!(SharedSecret);

impl From<[u8; SHARED_SECRET_SIZE]> for SharedSecret {
fn from(arr: [u8; SHARED_SECRET_SIZE]) -> Self {
SharedSecret(arr)
}
}

impl SharedSecret {
/// Creates a new shared secret from a pubkey and secret key.
#[inline]
Expand Down

0 comments on commit f78ac8c

Please sign in to comment.