import crypto from 'node:crypto'; // Unambiguous alphabet for human-shareable join codes: no 0/O or 1/I. const CODE_ALPHABET = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ'; export function randomId() { return crypto.randomUUID(); } export function randomToken() { return crypto.randomBytes(24).toString('base64url'); } export function randomJoinCode(length = 6) { let code = ''; for (let i = 0; i < length; i++) { code += CODE_ALPHABET[crypto.randomInt(CODE_ALPHABET.length)]; } return code; }