/** * Generate a ULID (Universally Unique Lexicographically Sortable ID). * Returns 26 characters with last character always '0' for perfect binary conversion. * * This ensures 100% lossless binary conversion (128 bits) while maintaining * full ULID spec compliance and interoperability with other ULID systems. * * Uses monotonic mode by default - ensures IDs are always increasing, * even if the system clock goes backwards. * * @param seedTime Optional timestamp in milliseconds to use for ID generation * @returns 26-character ULID string (last char always '0') */ declare function generateUlid(seedTime?: number): string; /** * Validate if a string is a valid ULID format. * * @param id The string to validate * @returns true if valid ULID format (26 characters, valid Crockford Base32) */ declare function isValidUlid(id: string): boolean; /** * Decode timestamp from a ULID string. * * @param id The ULID string (26 characters) * @returns Timestamp in milliseconds since Unix epoch * @throws Error if invalid ULID */ declare function decodeTimeFromUlid(id: string): number; /** * Get the age of a ULID in milliseconds. * * @param id The ULID string * @returns Age in milliseconds * @throws Error if invalid ULID */ declare function getUlidAge(id: string): number; /** * Parse a ULID and extract all its components. * * @param id The ULID string * @returns Object containing timestamp (ms), timestampSeconds, and age (ms) * @throws Error if invalid ULID */ declare function parseUlid(id: string): { timestamp: number; timestampSeconds: number; age: number; }; /** * Convert ULID (26-char base32) → 16-byte binary for lossless storage. * Works perfectly because last character is always '0' (uses only 128 bits). * * @param id The ULID string (26 characters) * @returns 16-byte Uint8Array * @throws Error if invalid ULID */ declare function ulidToBinary(id: string): Uint8Array; /** * Convert 16-byte binary ULID → 26-char string (lossless). * Last character will always be '0' (maintains consistency with generateUlid). * * @param input Binary ULID (16 bytes) * @returns 26-character ULID string * @throws Error if invalid input */ declare function binaryToUlid(input: Uint8Array | Buffer): string; export { binaryToUlid, decodeTimeFromUlid, generateUlid, getUlidAge, isValidUlid, parseUlid, ulidToBinary };