Skip to content
API reference

cairn

Import
import * as api from "@fungi.computer/cairn";
Kind Export Description
constant identifierDefinitionSchema Validate one bounded version 1 family declaration.
constant identifierCandidateSchema Decode a wire candidate before calling a typed string codec.
constant ALPHABET URL-safe lowercase alphabet used for opaque identifiers.
constant SHORT Identifier size for compact, non-security-sensitive labels.
constant DEFAULT Default identifier size.
constant LONG Identifier size for callers that require additional collision resistance.
function nanoid() Generate a raw opaque identifier through the runtime-selected nanoid implementation.

identifierDefinitionSchemaconstant

Section titled “identifierDefinitionSchema”
Signature
const identifierDefinitionSchema: ZodObject<
{
family: ZodString;
version: ZodLiteral<1>;
kinds: ZodRecord<
ZodString,
ZodObject<
{
prefix: ZodString;
},
$strip
>
>;
},
$strip
>;

Validate one bounded version 1 family declaration.


identifierCandidateSchemaconstant

Section titled “identifierCandidateSchema”
Signature
const identifierCandidateSchema: ZodString;

Decode a wire candidate before calling a typed string codec.


ALPHABETconstant

Section titled “ALPHABET”
Signature
const ALPHABET: "abcdefghijklmnopqrstuvwxyz0123456789" =
"abcdefghijklmnopqrstuvwxyz0123456789";

URL-safe lowercase alphabet used for opaque identifiers.


SHORTconstant

Section titled “SHORT”
Signature
const SHORT: 8 = 8;

Identifier size for compact, non-security-sensitive labels.


DEFAULTconstant

Section titled “DEFAULT”
Signature
const DEFAULT: 21 = 21;

Default identifier size.


LONGconstant

Section titled “LONG”
Signature
const LONG: 32 = 32;

Identifier size for callers that require additional collision resistance.

Signature
function nanoid(length?): string;

Generate a raw opaque identifier through the runtime-selected nanoid implementation.

Parameter Type Default value Description
length number DEFAULT Requested output size; supply a bounded nonnegative integer unless accepting upstream/runtime-specific behavior.

string

A lowercase alphanumeric identifier.

This legacy helper accepts trusted sizing-policy inputs; CPU and output scale with the requested size. Finite sizing values delegate exactly to the runtime-selected upstream implementation and may be runtime-specific. Callers should supply a bounded nonnegative integer unless they consciously accept upstream/runtime-specific behavior. Only positive and negative infinity receive Cairn’s fixed bounded RangeError. For new durable identifiers, use defineIdFamily.

If length is positive or negative infinity. Other finite-size exceptions follow the upstream runtime behavior.

Re-exports CairnDefinitionError


Re-exports CairnGenerationError


Re-exports defineIdFamily


Re-exports CairnId


Re-exports IdCodec


Re-exports IdFamily


Re-exports IdKindDefinition


Re-exports IdOf


Re-exports IdParseError


Re-exports IdParseResult


Re-exports ADJECTIVES


Re-exports NOUNS


Re-exports words


Re-exports replayKey


Re-exports deterministicReplayKey


Re-exports correlationKey


Re-exports createCorrelationSequence


Re-exports ReplayKey


Re-exports CorrelationKey