use crate::{cipher::Cipher, Aad, IntoAad};
use vitaminc_protected::{Controlled, Protected};
use zeroize::Zeroize;
pub mod impls;
pub trait Encrypt {
fn encrypt<C>(self, cipher: C) -> Result<C::Ok, C::Error>
where
Self: Sized,
C: Cipher,
{
self.encrypt_with_aad(cipher, Aad::empty())
}
fn encrypt_with_aad<'a, C, A>(self, cipher: C, aad: A) -> Result<C::Ok, C::Error>
where
C: Cipher,
A: IntoAad<'a>;
fn encrypt_protected<'a, C, A>(
this: Protected<Self>,
cipher: C,
aad: A,
) -> Result<C::Ok, C::Error>
where
Self: Sized + Zeroize,
C: Cipher,
A: IntoAad<'a>,
{
this.risky_unwrap().encrypt_with_aad(cipher, aad)
}
}