Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions dwctl/src/auth/password.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ pub fn hash_string(input: &str) -> Result<String, Error> {

/// Verify a string against a hash.
///
/// Note: Verification uses the parameters embedded in the hash itself,
/// so the params argument is ignored. It's included for API consistency.
pub fn verify_string_with_params(input: &str, hash: &str, _params: Option<Argon2Params>) -> Result<bool, Error> {
/// Note: Verification uses the parameters embedded in the hash itself.
pub fn verify_string(input: &str, hash: &str) -> Result<bool, Error> {
let parsed_hash = PasswordHash::new(hash).map_err(|e| Error::Internal {
operation: format!("parse hash: {e}"),
})?;
Expand All @@ -76,11 +75,6 @@ pub fn verify_string_with_params(input: &str, hash: &str, _params: Option<Argon2
Ok(argon2.verify_password(input.as_bytes(), &parsed_hash).is_ok())
}

/// Verify a string against a hash (convenience wrapper).
pub fn verify_string(input: &str, hash: &str) -> Result<bool, Error> {
verify_string_with_params(input, hash, None)
}

/// Generate a secure random token for password reset
pub fn generate_reset_token() -> String {
// Generate 32 bytes (256 bits) of cryptographically secure random data
Expand Down