Skip to main content

Module identity

Module identity 

Source
Expand description

Identity — the id type, and what makes one well-formed.

An id is a stable, opaque name for a document. This module is the read half of prov’s identity layer: the Id newtype, the alphabet and length it is spelled in, and verify — the check-character arithmetic that catches a typo’d id: link before it dangles silently.

Minting an id is a write, and lives in prov-identity. alongside the trigger set that decides when a document earns one. The split matters because this crate never issues an id; it only recognizes ids something else issued, which is exactly what link resolution needs.

§The ID scheme

Prov’s internal IDs share their lineage with diaryx’s ARK blades but carry no NAAN or shoulder — they are workspace-internal, not published permalinks (DESIGN §4’s two identity layers). The primitives come from the moid crate (minimal opaque ID): an ID is BLADE_RANDOM_LEN random characters from the 29-character NOID extended-digit alphabet (moid::Alphabet::noid_xdigit — digits plus consonants: no vowels, so no accidental words; no l, so no ambiguity with 1) plus one NOID check character, so a typo’d ID is detected rather than silently resolving to nothing. The alphabet is the canonical NOID one, so the check character agrees with a real NOID minter and not merely with our own arithmetic. An ID may therefore contain — and begin with — a digit; anything stamping one into metadata must keep it a string.

Structs§

Id
A stable, opaque document identifier.

Enums§

IdStorage
Where a document’s stable ID is persisted — the identity-storage axis (DESIGN §5). Orthogonal to when an ID is minted (prov’s Registration) and to how references are spelled; this is purely the ID’s home.

Constants§

BLADE_LEN
Total ID length: the random body plus one check character.
BLADE_RANDOM_LEN
Random characters per ID (excluding the check character). 29^6 ≈ 595M — collision-free in practice for a workspace, enforced absolutely by mint-with-rejection.

Functions§

verify
Prov IDs use BLADE_RANDOM_LEN random NOID extended-digit characters plus a NOID check character. Minting lives in prov-identity; this crate only verifies IDs. Whether id is a well-formed prov ID: correct length, alphabet-only, and a matching trailing check character. This is what catches a typo’d prov: link before it dangles silently.