import { randomBytes } from "node:crypto";

/**
 * Generates fresh secrets for .env (production deploy). Prints them in the
 * format expected by the zod env schema so you can copy/paste directly.
 * Usage:  npm run gen:secrets
 */
function secret(bytes = 32): string {
  return randomBytes(bytes).toString("base64url");
}

const out = `# ------------------------------------------------------------
# Generated ${new Date().toISOString()}
# Copy the values below into .env on the production host.
# Never commit real secrets to the repo.
# ------------------------------------------------------------
NEXTAUTH_SECRET=${secret(48)}
APPROVAL_TOKEN_SECRET=${secret(48)}
CRON_SECRET=${secret(32)}
SANITY_WEBHOOK_SECRET=${secret(24)}
NEXT_PUBLIC_SANITY_PREVIEW_SECRET=${secret(24)}
`;

console.log(out);
