pub mod impls;
use crate::{Aad, Decipher, IntoAad};
use vitaminc_protected::{Controlled, Protected};
use zeroize::Zeroize;
pub trait Decrypt<'c>: Sized + Send {
fn decrypt<D: Decipher<'c>>(decipher: D) -> D::Ok<Self> {
Self::decrypt_with_aad(decipher, Aad::empty())
}
fn decrypt_with_aad<'a, D, A>(decipher: D, aad: A) -> D::Ok<Self>
where
D: Decipher<'c>,
A: IntoAad<'a>;
fn decrypt_protected<'a, D, A>(decipher: D, aad: A) -> D::Ok<Protected<Self>>
where
Self: Zeroize + 'c,
D: Decipher<'c>,
A: IntoAad<'a>,
{
D::map_ok(
Self::decrypt_with_aad(decipher, aad),
Protected::init_from_inner,
)
}
}