Moved dispatching into a sepparate module
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
//! Functions to encrypt the database models
|
||||
|
||||
pub mod account;
|
||||
pub mod hashing;
|
||||
pub mod passwords;
|
||||
|
||||
/// Returns true if the field is valid
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn validate_field(field: &str) -> bool {
|
||||
if field.len() > 255 {
|
||||
return false;
|
||||
}
|
||||
field
|
||||
.chars()
|
||||
.all(|char| !['`', '\\', '\n', '\t'].contains(&char))
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum Error {
|
||||
#[error("Invalid input length")]
|
||||
InvalidInputLength,
|
||||
|
||||
#[error(transparent)]
|
||||
ChaCha(#[from] chacha20poly1305::Error),
|
||||
|
||||
#[error(transparent)]
|
||||
InvalidUTF8(#[from] std::string::FromUtf8Error),
|
||||
}
|
||||
|
||||
type Result<T> = std::result::Result<T, Error>;
|
Reference in New Issue
Block a user