import { InvalidInputError, UniqueIdError } from "../errors.mjs"; //#region src/cuid2/cuid2.d.ts type Cuid2Options = { /** * Length of the generated ID (2-32 characters). * Default: 24 */ length?: number; /** * Custom random bytes for deterministic testing. * Must be at least 1 byte. For adequate entropy, use at least 16 bytes. * Note: The fingerprint always uses cryptographically secure random bytes, * regardless of this option. */ random?: Uint8Array; }; type Cuid2 = { (options?: Cuid2Options): string; isValid(id: unknown): id is string; }; /** * Generate a CUID2 string. * * CUID2 is a secure, collision-resistant identifier that hashes multiple * entropy sources using SHA3-512. Unlike time-ordered IDs (ULID, UUID v7), * CUID2 prevents enumeration attacks by making IDs non-predictable. * * Note: CUID2 does not provide toBytes/fromBytes because it is a string-native * format with no canonical binary representation (unlike UUID's 16-byte format). * * @example * ```ts * import { cuid2 } from 'uniku/cuid2' * * const id = cuid2() * // => "pfh0haxfpzowht3oi213cqos" * * // Custom length * const shortId = cuid2({ length: 10 }) * // => "tz4a98xxat" * * // Validation (type guard) * const maybeId: unknown = getUserInput() * if (cuid2.isValid(maybeId)) { * console.log(maybeId.length) // TypeScript knows maybeId is string * } * ``` */ declare const cuid2: Cuid2; //#endregion export { Cuid2, Cuid2Options, InvalidInputError, UniqueIdError, cuid2 }; //# sourceMappingURL=cuid2.d.mts.map