#!/usr/bin/env node
import bcrypt from 'bcryptjs';
import { randomBytes } from 'node:crypto';

const password = process.argv[2];
if (!password) {
  console.error('Usage: npm run hash:password -- <mot_de_passe>');
  process.exit(1);
}

const hash = bcrypt.hashSync(password, 12);
const jwtSecret = randomBytes(48).toString('base64');

console.log('\n✅ Copier ce bloc dans ton .env ou variables Plesk :\n');
console.log(`ADMIN_PASSWORD_HASH=${hash}`);
console.log(`ADMIN_JWT_SECRET=${jwtSecret}\n`);
