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é.

Object Safety§

This trait is not object safe.

Implementors§