import type { BackofficePasswordHasher } from '../domain/ports.js';

/** Production hasher: Argon2id. Tests can inject a fake. */
export class Argon2BackofficePasswordHasher implements BackofficePasswordHasher {
  async hash(plain: string): Promise<string> {
    const { default: argon2 } = await import('argon2');
    return argon2.hash(plain);
  }
  async verify(hash: string, plain: string): Promise<boolean> {
    const { default: argon2 } = await import('argon2');
    return argon2.verify(hash, plain);
  }
}
