1 2 3 4 5 6 7 8 9 10 11 12 13 14
pub trait Encryptor<'a> { fn encrypt(&self, password: &str) -> Result<(String, String), EncryptionError>; } pub trait Validator { fn validate(&self, password: &str, salt: &str, encoded_password: &str) -> bool; } #[derive(thiserror::Error, Debug)] pub enum EncryptionError { #[error("Can't generate a salt")] SaltError, }