1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use super::Error; pub trait KeyContext{ const KEYLENGTH: usize; //optional fn is_valid_key(_arr:&[u8]) -> bool{ true } fn context(&self)->String{ "".to_string() } } pub trait PublicKeyContext{ const ISPUBLICKEY: bool = true; } pub trait FromUnsafeSlice{ type RHS; fn from_unsafe_slice(slice:&[u8])-> Result <Self::RHS, Error>; fn from_unsafe_secret_slice(secret_slice:&[u8]) -> Result< Self::RHS, Error>; }