/**
 * 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);
  }
}
