import bcrypt from "bcryptjs";

// bcryptjs is pure-JS: no native build step, works out of the box in Alpine.
const ROUNDS = 10;

export function hashPassword(password: string): Promise<string> {
  return bcrypt.hash(password, ROUNDS);
}

export function verifyPassword(
  password: string,
  hash: string,
): Promise<boolean> {
  return bcrypt.compare(password, hash);
}
