use crate::error::Result; use rand::{CryptoRng, RngCore};
use zeroize::Zeroize;
#[cfg(all(not(feature = "std"), feature = "alloc"))]
use alloc::vec::Vec;
#[cfg(feature = "std")]
use std::vec::Vec;
pub trait Pke {
type PublicKey: AsRef<[u8]> + Clone;
type SecretKey: Zeroize + AsRef<[u8]> + Clone;
type Ciphertext: AsRef<[u8]> + Clone;
fn name() -> &'static str;
fn keypair<R: CryptoRng + RngCore>(rng: &mut R) -> Result<(Self::PublicKey, Self::SecretKey)>;
fn encrypt<R: RngCore + CryptoRng>(
pk_recipient: &Self::PublicKey,
plaintext: &[u8],
aad: Option<&[u8]>,
rng: &mut R,
) -> Result<Self::Ciphertext>;
fn decrypt(
sk_recipient: &Self::SecretKey,
ciphertext: &Self::Ciphertext,
aad: Option<&[u8]>,
) -> Result<Vec<u8>>;
}