Skip to content

Commit 16e37ec

Browse files
committed
Allow SharedSecret to be created from byte array
This was accidentally removed in 8b2edad. See also the discussion on #402
1 parent 39e47fb commit 16e37ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ecdh.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ const SHARED_SECRET_SIZE: usize = constants::SECRET_KEY_SIZE;
4747
pub struct SharedSecret([u8; SHARED_SECRET_SIZE]);
4848
impl_display_secret!(SharedSecret);
4949

50+
impl From<[u8; SHARED_SECRET_SIZE]> for SharedSecret {
51+
fn from(arr: [u8; SHARED_SECRET_SIZE]) -> Self {
52+
Self(arr)
53+
}
54+
}
55+
5056
impl SharedSecret {
5157
/// Creates a new shared secret from a pubkey and secret key.
5258
#[inline]

0 commit comments

Comments
 (0)