1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! TODO

use bytes::Bytes;

pub mod ed25519;

pub type PublicKey = Bytes;
pub type Signature = Bytes;

pub trait Crypto: Send + Sync + Clone + 'static {
    fn me(&self) -> PublicKey;
    fn sign(&mut self, data: Vec<u8>) -> Signature;

    fn validate(public_key: &PublicKey) -> bool;
    fn verify(data: Vec<u8>, public_key: &PublicKey, signature: &Signature) -> bool;
}