pub trait ModelHelper<K>: Schema<PrimaryKey = K>{
// Provided methods
fn secret_key() -> &'static [u8] ⓘ { ... }
fn encrypt_password(password: &str) -> Result<String, Error> { ... }
fn verify_password(
password: &str,
encrypted_password: &str,
) -> Result<bool, Error> { ... }
fn translate_model(model: &mut Map) { ... }
}
Expand description
Helper utilities for models.
Provided Methods§
Sourcefn secret_key() -> &'static [u8] ⓘ
fn secret_key() -> &'static [u8] ⓘ
Returns the secret key for the model. It should have at least 64 bytes.
§Note
This should only be used for internal services. Do not expose it to external users.
Sourcefn encrypt_password(password: &str) -> Result<String, Error>
fn encrypt_password(password: &str) -> Result<String, Error>
Encrypts the password for the model.
Sourcefn verify_password(
password: &str,
encrypted_password: &str,
) -> Result<bool, Error>
fn verify_password( password: &str, encrypted_password: &str, ) -> Result<bool, Error>
Verifies the password for the model.
Sourcefn translate_model(model: &mut Map)
fn translate_model(model: &mut Map)
Translates the model data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.