// Wrapping bcryptjs in a small module so the rest of the app does not
// import bcrypt directly. Makes it easy to swap to argon2 later without
// touching every call site.

import bcrypt from 'bcryptjs';

const SALT_ROUNDS = 10;

export async function hashPassword(plain: string): Promise<string> {
  return bcrypt.hash(plain, SALT_ROUNDS);
}

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