feat: add trait to convert slice into X25519PublicKey
This commit is contained in:
@@ -23,6 +23,14 @@ pub struct X25519PubKey<'a>(SharedPtr<'a, 32>);
|
||||
#[derive(Debug)]
|
||||
pub struct X25519SharedKey<'a>(SharedPtr<'a, 32>);
|
||||
|
||||
impl From<&[u8; 32]> for X25519PubKey<'_> {
|
||||
fn from(value: &[u8; 32]) -> Self {
|
||||
let mut pk = SharedPtr::<32>::new().unwrap();
|
||||
pk.copy_from_slice(value);
|
||||
X25519PubKey(pk)
|
||||
}
|
||||
}
|
||||
|
||||
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