variable / @typed/id

uuid5

Derives a deterministic UUID version 5 from a UTF-8 name and 16-byte namespace.

Package version
1.0.0-beta.13
Category
ID generation
Since
1.0.0

Import

import { uuid5 } from "@typed/id";

Signatures

export declare const uuid5: {
    (namespace: Uuid5Namespace): (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
    (name: string, namespace: Uuid5Namespace): Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
};

Why

Determinism is exact for the same name bytes and namespace. Invalid namespace length fails in the typed channel with IllegalArgumentError; missing Web Crypto or a rejected SHA-1 digest is an Effect defect, not a typed error.

Ownership and lifetime

Each Effect acquires no persistent resources, reads but does not retain the namespace, and uses Web Crypto subtle.digest for the invocation.

Examples

import { uuid5, Uuid5Namespace } from "@typed/id/Uuid5"
const id = uuid5("example.com", Uuid5Namespace.DNS)

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source