refactor to adapters

This commit is contained in:
2025-12-15 18:34:20 +01:00
parent fc671482c8
commit c817d76092
145 changed files with 906 additions and 361 deletions

View File

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