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