type-alias / @typed/id/Cuid

CuidSeed

The complete deterministic input used to derive one CUID.

Package version
1.0.0-beta.7
Category
ID types
Since
1.0.0

Import

import { CuidSeed } from "@typed/id/Cuid";

Signatures

export type CuidSeed = {
    readonly timestamp: number;
    readonly counter: number;
    readonly random: Uint8Array & {
        readonly length: 32;
    };
    readonly fingerprint: string;
};

Why

Keeping time, sequence, entropy, and caller fingerprint explicit makes generator identity rules testable and reviewable.

Ownership and lifetime

This data acquires no resources; callers own the random byte array and state services produce fresh seeds.

Property: counter

Process-local sequence value for this seed. Inherits the seed’s resource-free lifetime.

Property: fingerprint

Caller-derived discriminator captured by the CuidState instance.

Property: random

Fresh 32-byte entropy buffer owned by this seed’s consumer.

Property: timestamp

Millisecond timestamp sampled for this seed. Inherits the seed’s resource-free lifetime.

Examples

import type { CuidSeed } from "@typed/id/Cuid"
const seed: CuidSeed = { timestamp: 0, counter: 0, random: new Uint8Array(32) as CuidSeed["random"], fingerprint: "test" }

Other public imports

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

Source