variable / @typed/id/Uuid4

uuid4

Generates an RFC UUID version 4 from 16 fresh random bytes.

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

Import

import { uuid4 } from "@typed/id/Uuid4";

Signatures

export declare const uuid4: Effect.Effect<Uuid4, never, RandomValues>;

Why

Effectful generation exposes entropy as a service and explicitly sets version and variant bits; custom services must return a usable fresh buffer.

Ownership and lifetime

The invocation mutates only its fresh byte buffer, acquires no persistent resource, and returns an immutable string.

Examples

import { uuid4 } from "@typed/id/Uuid4"
import { RandomValues } from "@typed/id/RandomValues"
import { Effect } from "effect"
const id = Effect.provide(uuid4, RandomValues.Default)

Other public imports

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

Source