1use crate::types::*;
5
6pub mod sodium;
7pub use sodium::*;
8
9#[cfg(feature = "crypto-dalek")]
10pub mod dalek;
11
12pub trait Signer {
14 type Error;
15
16 fn sign(&mut self, id: &Id, data: &[u8]) -> Result<Signature, Self::Error>;
17}
18
19pub trait Validator {
23 type Error;
24
25 fn validate(&self, id: &Id, sig: &Signature, data: &[u8]) -> Result<bool, Self::Error>;
26}
27
28pub trait Encrypter {
30 type Error;
31
32 fn encrypt(&mut self, id: &Id, key: &SecretKey, data: &mut [u8]) -> Result<(), Self::Error>;
33}
34
35pub trait Decrypter {
37 type Error;
38
39 fn decrypt(&mut self, id: &Id, key: &SecretKey, data: &mut [u8]) -> Result<(), Self::Error>;
40}