UNPKG

@auth0/nextjs-auth0

Version:
8 lines (7 loc) 288 B
// generateSecret generates a secure random string of the given length. export async function generateSecret(length) { const bytes = crypto.getRandomValues(new Uint8Array(length)); return Array.from(bytes) .map((b) => b.toString(16).padStart(2, "0")) .join(""); }