From 9925eb2b22d6a4da3b6dcb0effbc5eb014d9cb0d Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 30 Nov 2023 16:25:38 +0100 Subject: implement conversion from opaque structs to value --- src/kem.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/kem.rs') diff --git a/src/kem.rs b/src/kem.rs index 091247d..a97d34f 100644 --- a/src/kem.rs +++ b/src/kem.rs @@ -69,6 +69,12 @@ impl From<::PublicKey> for PublicKey { } } +impl From for ::PublicKey { + fn from(value: PublicKey) -> Self { + value.0 + } +} + impl ByteAccess for PublicKey { fn bytes(&self) -> Vec { bincode::serialize(&self.0).unwrap() @@ -102,6 +108,12 @@ impl From<::MasterKey> for MasterKey { } } +impl From for ::MasterKey { + fn from(value: MasterKey) -> Self { + value.0 + } +} + impl ByteAccess for MasterKey { fn bytes(&self) -> Vec { bincode::serialize(&self.0).unwrap() @@ -135,6 +147,12 @@ impl From<::PrivateKey> for PrivateKey { } } +impl From for ::PrivateKey { + fn from(value: PrivateKey) -> Self { + value.0 + } +} + impl ByteAccess for PrivateKey { fn bytes(&self) -> Vec { bincode::serialize(&self.0).unwrap() @@ -169,6 +187,12 @@ impl From<::EncapsulatedKey> for EncapsulatedKey { } } +impl From for ::EncapsulatedKey { + fn from(value: EncapsulatedKey) -> Self { + value.0 + } +} + impl ByteAccess for EncapsulatedKey { fn bytes(&self) -> Vec { bincode::serialize(&self.0).unwrap() -- cgit v1.2.3