1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-07 17:03:01 +03:00

Flatten the passwords config section

This commit is contained in:
Quentin Gliech
2024-03-21 16:54:00 +01:00
parent 8bc35f63d8
commit f5b34b5b18
4 changed files with 123 additions and 104 deletions

View File

@@ -41,11 +41,11 @@ pub async fn password_manager_from_config(
.load()
.await?
.into_iter()
.map(|(version, algorithm, secret)| {
.map(|(version, algorithm, cost, secret)| {
use mas_handlers::passwords::Hasher;
let hasher = match algorithm {
mas_config::PasswordAlgorithm::Pbkdf2 => Hasher::pbkdf2(secret),
mas_config::PasswordAlgorithm::Bcrypt { cost } => Hasher::bcrypt(cost, secret),
mas_config::PasswordAlgorithm::Bcrypt => Hasher::bcrypt(cost, secret),
mas_config::PasswordAlgorithm::Argon2id => Hasher::argon2id(secret),
};