Open indirection42 opened 9 months ago
Since we use a default PHC string to make the verifying time-constant, the actual Unknown Username case will be early returned as Invalid password.
Unknown Username
Invalid password
spawn_blocking_with_tracing(move || { verify_password_hash(expected_password_hash, credentials.password) }) .await // early return .context("Failed to spawn blocking task.")??; user_id // dead code .ok_or_else(|| anyhow::anyhow!("Unknown username.")) .map_err(AuthError::InvalidCredentials)
Since we use a default PHC string to make the verifying time-constant, the actual
Unknown Username
case will be early returned asInvalid password
.