feat: add trait to convert slice into X25519PrivKey
This commit is contained in:
@@ -31,6 +31,14 @@ impl From<&[u8; 32]> for X25519PubKey<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&[u8; 8]> for X25519PrivKey<'_> {
|
||||
fn from(value: &[u8; 8]) -> Self {
|
||||
let mut sk = SharedPtr::<8>::new().unwrap();
|
||||
sk.copy_from_slice(value);
|
||||
X25519PrivKey(sk)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn x25519_keygen<'a>() -> (X25519PrivKey<'a>, X25519PubKey<'a>) {
|
||||
let sk = X25519PrivKey(SharedPtr::<8>::new().unwrap());
|
||||
let pk = X25519PubKey(SharedPtr::<32>::new().unwrap());
|
||||
|
||||
Reference in New Issue
Block a user