use crate::error::Result;
pub trait Kem {
type PublicKey: AsRef<[u8]> + Clone;
type SecretKey: AsRef<[u8]> + Clone;
type Ciphertext: AsRef<[u8]> + Clone;
type SharedSecret: AsRef<[u8]> + Clone;
fn keypair(&self) -> (Self::PublicKey, Self::SecretKey);
fn encapsulate(&self, pk: &Self::PublicKey) -> (Self::Ciphertext, Self::SharedSecret);
fn decapsulate(&self, sk: &Self::SecretKey, ct: &Self::Ciphertext) -> Self::SharedSecret;
}
pub trait Signature {
type PublicKey: AsRef<[u8]> + Clone;
type SecretKey: AsRef<[u8]> + Clone;
type Signature: AsRef<[u8]> + Clone;
fn keypair(&self) -> (Self::PublicKey, Self::SecretKey);
fn sign(&self, sk: &Self::SecretKey, msg: &[u8]) -> Self::Signature;
fn verify(&self, pk: &Self::PublicKey, msg: &[u8], sig: &Self::Signature) -> bool;
}
pub trait Aead {
type Key: AsRef<[u8]> + Clone;
type Nonce: AsRef<[u8]> + Clone;
fn seal(&self, key: &Self::Key, nonce: &Self::Nonce, aad: &[u8], plaintext: &[u8]) -> Result<Vec<u8>>;
fn open(&self, key: &Self::Key, nonce: &Self::Nonce, aad: &[u8], ciphertext: &[u8]) -> Result<Vec<u8>>;
}
pub trait Hkdf {
fn extract(salt: &[u8], ikm: &[u8]) -> Vec<u8>;
fn expand(prk: &[u8], info: &[u8], len: usize) -> Vec<u8>;
}