/** * Python uuid module for TypeScript * * Provides UUID objects as specified in RFC 4122. * * @see {@link https://docs.python.org/3/library/uuid.html | Python uuid documentation} * @module */ /** * UUID class representing a universally unique identifier. */ declare class UUID { private readonly _bytes; /** Helper to safely get byte at index */ private getByte; /** * Create a UUID from various input formats. * * @param hex - Hexadecimal string (with or without hyphens) * @param bytes - 16 bytes as Uint8Array * @param int - Integer value */ constructor(options: { hex: string; } | { bytes: Uint8Array; } | { int: bigint; } | string); /** * The UUID as a 32-character lowercase hexadecimal string. */ get hex(): string; /** * The UUID as a 16-byte Uint8Array. */ get bytes(): Uint8Array; /** * The UUID as a 128-bit integer. */ get int(): bigint; /** * The version number (1 through 5, as an integer). */ get version(): number; /** * The variant (reserved bits). */ get variant(): string; /** * The UUID as a hyphenated string (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). */ toString(): string; /** * The UUID as a URN (urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). */ get urn(): string; /** * Compare UUIDs for equality. */ equals(other: UUID): boolean; /** * Get the time_low field (first 32 bits). */ get timeLow(): number; /** * Get the time_mid field (next 16 bits). */ get timeMid(): number; /** * Get the time_hi_version field (next 16 bits). */ get timeHiVersion(): number; /** * Get the clock_seq_hi_variant field. */ get clockSeqHiVariant(): number; /** * Get the clock_seq_low field. */ get clockSeqLow(): number; /** * Get the node field (last 48 bits). */ get node(): bigint; } /** * Generate a random UUID (version 4). * * Uses crypto.randomUUID() when available, otherwise falls back to * crypto.getRandomValues(). * * @returns A new random UUID * * @example * ```typescript * const id = uuid4() * console.log(id.toString()) // "550e8400-e29b-41d4-a716-446655440000" * ``` */ declare function uuid4(): UUID; /** * Generate a UUID based on host ID and current time (version 1). * * Note: In browser environments, the node ID is randomly generated * since MAC addresses are not accessible. * * @param node - Optional 48-bit node ID (defaults to random) * @param clockSeq - Optional 14-bit clock sequence (defaults to random) * @returns A new time-based UUID */ declare function uuid1(node?: bigint, clockSeq?: number): UUID; /** * Generate a UUID based on the MD5 hash of a namespace identifier and a name (version 3). * * @param namespace - The namespace UUID * @param name - The name string * @returns A new name-based UUID using MD5 */ declare function uuid3(_namespace: UUID, _name: string): UUID; /** * Generate a UUID based on the SHA-1 hash of a namespace identifier and a name (version 5). * * @param namespace - The namespace UUID * @param name - The name string * @returns A new name-based UUID using SHA-1 */ declare function uuid5(_namespace: UUID, _name: string): UUID; /** * The namespace UUID for DNS domain names. */ declare const NAMESPACE_DNS: UUID; /** * The namespace UUID for URLs. */ declare const NAMESPACE_URL: UUID; /** * The namespace UUID for ISO OIDs. */ declare const NAMESPACE_OID: UUID; /** * The namespace UUID for X.500 DNs. */ declare const NAMESPACE_X500: UUID; declare const uuidModule_NAMESPACE_DNS: typeof NAMESPACE_DNS; declare const uuidModule_NAMESPACE_OID: typeof NAMESPACE_OID; declare const uuidModule_NAMESPACE_URL: typeof NAMESPACE_URL; declare const uuidModule_NAMESPACE_X500: typeof NAMESPACE_X500; type uuidModule_UUID = UUID; declare const uuidModule_UUID: typeof UUID; declare const uuidModule_uuid1: typeof uuid1; declare const uuidModule_uuid3: typeof uuid3; declare const uuidModule_uuid4: typeof uuid4; declare const uuidModule_uuid5: typeof uuid5; declare namespace uuidModule { export { uuidModule_NAMESPACE_DNS as NAMESPACE_DNS, uuidModule_NAMESPACE_OID as NAMESPACE_OID, uuidModule_NAMESPACE_URL as NAMESPACE_URL, uuidModule_NAMESPACE_X500 as NAMESPACE_X500, uuidModule_UUID as UUID, uuidModule_uuid1 as uuid1, uuidModule_uuid3 as uuid3, uuidModule_uuid4 as uuid4, uuidModule_uuid5 as uuid5 }; } export { NAMESPACE_DNS as N, UUID as U, NAMESPACE_OID as a, NAMESPACE_URL as b, NAMESPACE_X500 as c, uuid1 as d, uuid3 as e, uuid4 as f, uuid5 as g, uuidModule as u };