1use alloc::vec::Vec;
4use rand_core::TryCryptoRng;
5
6use crate::errors::Result;
7
8pub trait RandomizedEncryptor {
10 #[allow(clippy::missing_errors_doc, reason = "TODO")]
12 fn encrypt_with_rng<R: TryCryptoRng + ?Sized>(
13 &self,
14 rng: &mut R,
15 msg: &[u8],
16 ) -> Result<Vec<u8>>;
17}
18
19pub trait Decryptor {
21 #[allow(clippy::missing_errors_doc, reason = "TODO")]
23 fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>>;
24}
25
26pub trait RandomizedDecryptor {
28 #[allow(clippy::missing_errors_doc, reason = "TODO")]
30 fn decrypt_with_rng<R: TryCryptoRng + ?Sized>(
31 &self,
32 rng: &mut R,
33 ciphertext: &[u8],
34 ) -> Result<Vec<u8>>;
35}
36
37pub trait EncryptingKeypair {
39 type EncryptingKey: Clone;
41
42 fn encrypting_key(&self) -> Self::EncryptingKey;
45}