import { PasswordHash } from '../value-objects/PasswordHash'; /** * Domain Service: PasswordHashingService * * Service for password hashing and verification. */ export interface IPasswordHashingService { hash(plain: string): Promise; verify(plain: string, hash: string): Promise; } /** * Implementation using bcrypt via PasswordHash VO. */ export class PasswordHashingService implements IPasswordHashingService { async hash(plain: string): Promise { const passwordHash = await PasswordHash.create(plain); return passwordHash.value; } async verify(plain: string, hash: string): Promise { const passwordHash = PasswordHash.fromHash(hash); return passwordHash.verify(plain); } }