//! PasswordService port — password hashing and verification abstraction. //! //! Defines the trait that password-hashing adapters (argon2, bcrypt, etc.) //! implement. The application layer depends only on this trait, never on //! a concrete hashing library. use anyhow::Result; use std::future::Future; /// Abstraction for password hashing and verification. /// /// Implementors handle the actual hashing algorithm (argon2, bcrypt, etc.) /// and parameter selection. The trait is `Send + Sync` for use in async /// service layers. pub trait PasswordService: Send + Sync { /// Hash a plaintext password and return the encoded hash string /// (suitable for storage in a credential store). fn hash(&self, password: &str) -> impl Future> + Send; /// Verify a plaintext password against a previously-hashed string. /// /// Returns `true` if the password matches the hash, `false` otherwise. fn verify(&self, password: &str, hash: &str) -> impl Future> + Send; }