use crate::errors::Result;
pub trait CryptographyBridge: Clone {
type PublicKey: Clone;
type SecretKey: Clone;
type SignedMessage: Clone + std::fmt::Debug;
fn key_generator(&self) -> Result<(Self::PublicKey, Self::SecretKey)>;
fn sign(&self, secret_key: &Self::SecretKey, message: &[u8]) -> Result<Self::SignedMessage>;
fn verify(
&self,
public_key: &Self::PublicKey,
message: &[u8],
signature: &Self::SignedMessage,
) -> Result<bool>;
fn public_key_to_bytes(&self, public_key: &Self::PublicKey) -> Vec<u8>;
fn secret_key_to_bytes(&self, secret_key: &Self::SecretKey) -> Vec<u8>;
fn signature_to_bytes(&self, signature: &Self::SignedMessage) -> Vec<u8>;
}
pub trait KeyEncapsulationBridge: Clone {
type PublicKey: Clone;
type SecretKey: Clone;
type Ciphertext: Clone;
type SharedSecret: Clone;
fn kem_keygen(&self) -> Result<(Self::PublicKey, Self::SecretKey)>;
fn encapsulate(
&self,
public_key: &Self::PublicKey,
) -> Result<(Self::Ciphertext, Self::SharedSecret)>;
fn decapsulate(
&self,
secret_key: &Self::SecretKey,
ciphertext: &Self::Ciphertext,
) -> Result<Self::SharedSecret>;
fn kem_public_key_to_bytes(&self, public_key: &Self::PublicKey) -> Vec<u8>;
}