Trait PasswordEncryption

Source
pub trait PasswordEncryption: Clone {
    // Required methods
    fn new(secret: impl ToString) -> Self;
    fn encrypt_password(
        &self,
        credential: impl AsRef<str>,
    ) -> Result<String, Box<dyn Error + Send + Sync>>;
    fn verify_password(
        &self,
        encrypted: impl AsRef<str>,
        credential: impl AsRef<str>,
    ) -> bool;
}

Required Methods§

Source

fn new(secret: impl ToString) -> Self

Source

fn encrypt_password( &self, credential: impl AsRef<str>, ) -> Result<String, Box<dyn Error + Send + Sync>>

Chiffre un mot de passe avec un algorithme de hachage / chiffrement.

Source

fn verify_password( &self, encrypted: impl AsRef<str>, credential: impl AsRef<str>, ) -> bool

Vérifie le mot de passe à l’aide du hachage codé.

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.

Implementors§