Lucia

generateId()

Generates a cryptographically strong random string made of a-z (lowercase) and 0-9.

Unless you have a strict length requirement, use generateIdFromEntropySize() which provides better performance.

Definition

function generateId(length: number): string;

Parameters

  • length

Example

import { generateId } from "lucia";

// 10-characters long string
generateId(10);