Skip to content

Status

Cairn is on version 0.0.0. Until 1.0, a minor release can change the public API, so pin the version you test against.

ID generation needs secure randomness. If that source is unavailable, Cairn throws CairnGenerationError with the validated family and kind. Invalid trusted family declarations throw CairnDefinitionError. The caller must use the codec’s schema at an untrusted wire boundary before passing data to parse.

The root nanoid(length) export is retained for callers that need a raw random string. Its finite length coercion follows the selected upstream runtime implementation. Use a bounded nonnegative integer for predictable results. LONG is a conventional size, not a maximum. Likewise, words({ count }) keeps legacy count coercion and does not impose a maximum. CPU and output grow with the requested size, so validate and bound untrusted sizing values before calling either helper. Use defineIdFamily for durable domain IDs.

Cairn’s license is MIT. See LICENSE. Its direct runtime dependencies are nanoid, Zod, and uuid. Consult their package distributions for their license terms.