Files
hackathon-opti-1a67c9077937…/backend/src/config/bcrypt.ts
2026-05-22 19:26:38 -06:00

19 lines
455 B
TypeScript

/**
* bcrypt.ts
* BcryptAdapter: hashea y compara contraseñas.
* Encapsula toda la lógica de bcrypt en un lugar.
*/
import bcrypt from "bcryptjs";
import { env } from "./env.js";
export class BcryptAdapter {
static async hash(password: string): Promise<string> {
return bcrypt.hash(password, env.BCRYPT_ROUNDS);
}
static async compare(password: string, hash: string): Promise<boolean> {
return bcrypt.compare(password, hash);
}
}