import { randomBytes } from "node:crypto"; /** * Cryptographically secure hex string of `bytes` random bytes (i.e. * `bytes * 2` hex characters) — the one generator used for every secret * this app creates on a business's behalf (database password, * `AUTH_SECRET`, `INSTALLATION_TOKEN`, `CRON_SECRET`). Pulled out of * provisioning.ts into its own module so a later rotate/regenerate * action (e.g. re-issuing `INSTALLATION_TOKEN`) reuses this exact * mechanism instead of a second, duplicate one. */ export function randomHex(bytes: number): string { return randomBytes(bytes).toString("hex"); }