/** * Generates a RFC4122 v1 UUID (time-based). * @param options Can use RFC time sequence values as overwrites. * @param buf Can allow the UUID to be written in byte-form starting at the offset. * @param offset Index to start writing on the UUID bytes in buffer. */ declare function generate(options?: V1Options | null, buf?: number[], offset?: number): string | number[]; /** * @deprecated v4 UUID generation is deprecated and will be removed in a future * std/uuid release. Use the web standard `globalThis.crypto.randomUUID()` * function instead. * * Generate a RFC4122 v4 UUID (pseudo-random). */ declare function generate_2(): string; /** * Generate a RFC4122 v5 UUID (SHA-1 namespace). * * ```js * import { generate } from "./v5.ts"; * * const NAMESPACE_URL = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"; * * const uuid = await generate(NAMESPACE_URL, new TextEncoder().encode("python.org")); * uuid === "886313e1-3b8a-5372-9b90-0c9aee199e5d" // true * ``` * * @param namespace The namespace to use, encoded as a UUID. * @param data The data to hash to calculate the SHA-1 digest for the UUID. */ declare function generate_3(namespace: string, data: Uint8Array): Promise; /** * Check if the passed UUID is the nil UUID. * * ```js * import { isNil } from "./mod.ts"; * * isNil("00000000-0000-0000-0000-000000000000") // true * isNil(crypto.randomUUID()) // false * ``` */ export declare function isNil(id: string): boolean; export declare const NIL_UUID = "00000000-0000-0000-0000-000000000000"; declare namespace v1 { export { validate_2 as validate, generate, V1Options } } export { v1 } /** The options used for generating a v1 UUID. */ declare interface V1Options { node?: number[]; clockseq?: number; msecs?: number; nsecs?: number; random?: number[]; rng?: () => number[]; } declare namespace v4 { export { validate_3 as validate, generate_2 as generate } } export { v4 } declare namespace v5 { export { validate_4 as validate, generate_3 as generate } } export { v5 } /** * Test a string to see if it is a valid UUID. * * ```js * import { validate } from "./mod.ts" * * validate("not a UUID") // false * validate("6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b") // true * ``` */ export declare function validate(uuid: string): boolean; /** * Validates the UUID v1. * @param id UUID value. */ declare function validate_2(id: string): boolean; /** * Validate that the passed UUID is an RFC4122 v4 UUID. * * ```ts * import { validate } from "./v4.ts"; * import { generate as generateV1 } from "./v1.ts"; * * validate(crypto.randomUUID()); // true * validate(generateV1() as string); // false * validate("this-is-not-a-uuid"); // false * ``` */ declare function validate_3(id: string): boolean; /** * Validate that the passed UUID is an RFC4122 v5 UUID. * * ```ts * import { generate as generateV5, validate } from "./v5.ts"; * * validate(await generateV5("6ba7b810-9dad-11d1-80b4-00c04fd430c8", new Uint8Array())); // true * validate(crypto.randomUUID()); // false * validate("this-is-not-a-uuid"); // false * ``` */ declare function validate_4(id: string): boolean; /** * Detect RFC version of a UUID. * * ```js * import { version } from "./mod.ts" * * version("d9428888-122b-11e1-b85c-61cd3cbb3210") // 1 * version("109156be-c4fb-41ea-b1b4-efe1671c5836") // 4 * ``` */ export declare function version(uuid: string): number; export { }