domain crate code quality cleanup
strip all comments, extract tests to tests/ dirs, remove #[allow(clippy::...)], extract magic numbers to constants, refactor schedule engine private methods to use param structs, add Default impls, clippy.toml for persistence constructors
This commit is contained in:
@@ -1,19 +1,8 @@
|
||||
//! Authentication port.
|
||||
//!
|
||||
//! Abstracts password hashing and verification so the domain layer
|
||||
//! never depends on a specific hashing algorithm (bcrypt, argon2, etc.).
|
||||
|
||||
use crate::errors::DomainResult;
|
||||
|
||||
/// Port for password hashing and verification.
|
||||
///
|
||||
/// Implementations live in the infra layer (e.g. `BcryptAuthService`).
|
||||
/// These methods are intentionally synchronous — hashing libraries are CPU-bound
|
||||
/// and should be spawned on a blocking thread pool by the caller if needed.
|
||||
// Intentionally sync: CPU-bound hashing should run on a blocking thread pool
|
||||
pub trait AuthService: Send + Sync {
|
||||
/// Hash a plaintext password and return the encoded hash string.
|
||||
fn hash_password(&self, password: &str) -> DomainResult<String>;
|
||||
|
||||
/// Verify a plaintext password against an encoded hash.
|
||||
fn verify_password(&self, password: &str, hash: &str) -> DomainResult<bool>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user