Portable value boundary for the governed-act record layer.
Durable records are reduced to plain maps and values before they enter the
ledger. This module rejects runtime-local capabilities (PID, port,
reference and function values), improper lists, structs, non-byte-aligned
bitstrings and non-finite floats. Accepted values are encoded through the
versioned ExGAM.Canonical.Value codec, so map iteration order never
affects a digest.
Content references have the form "prefix:sha256". They are identifiers
for immutable content, not proof that the content is authoritative.
Summary
Functions
Alias for canonical_value/1, useful at generic record boundaries.
Projects known atom fields into the strict string-keyed record representation.
Validates and returns a plain canonical map.
Returns the deterministic, versioned canonical bytes for a portable value.
Returns canonical bytes or raises when value is not portable.
Builds a stable prefix:digest reference for portable content.
Builds a stable content reference or raises.
Returns the lowercase SHA-256 digest of a portable value.
Returns a digest or raises when value is not portable.
Guard for opaque non-empty binary identifiers, without claiming content validity.
Guard shared by revisions, generations and elapsed millisecond windows.
Guard for a canonical object container, excluding runtime structs.
Guard for strictly positive revisions and quantities.
Checks host keyword options without raising on non-list input.
Normalizes map or keyword attributes and rejects unknown/duplicate keys.
Validates, de-duplicates and sorts a reference list.
Short alias for content_ref/2.
Computes a content reference and rejects a supplied reference that does not match it.
Restores a record only from the exact plain representation emitted by it.
Recursively converts atom map keys to strings without changing atom values.
Validates a plain record value within the canonical codec's default resource limits.
Checks a prefix:<lowercase sha256> content-addressed reference.
Checks a required non-empty binary field.
Checks an optional opaque record reference.
Checks an opaque record reference. References are non-empty binaries.
Checks a list of opaque record references.
Types
Functions
Alias for canonical_value/1, useful at generic record boundaries.
Projects known atom fields into the strict string-keyed record representation.
Validates and returns a plain canonical map.
Returns the deterministic, versioned canonical bytes for a portable value.
Returns canonical bytes or raises when value is not portable.
Builds a stable prefix:digest reference for portable content.
Builds a stable content reference or raises.
Returns the lowercase SHA-256 digest of a portable value.
Returns a digest or raises when value is not portable.
Guard for opaque non-empty binary identifiers, without claiming content validity.
Guard shared by revisions, generations and elapsed millisecond windows.
Guard for a canonical object container, excluding runtime structs.
Guard for strictly positive revisions and quantities.
Checks host keyword options without raising on non-list input.
Normalizes map or keyword attributes and rejects unknown/duplicate keys.
Validates, de-duplicates and sorts a reference list.
Short alias for content_ref/2.
@spec resolve_content_ref(String.t() | atom(), nil | String.t(), term()) :: {:ok, String.t()} | {:error, reason()}
Computes a content reference and rejects a supplied reference that does not match it.
@spec restore_canonical( term(), (term() -> {:ok, term()} | {:error, reason()}), (term() -> map()), atom() ) :: {:ok, term()} | {:error, reason()}
Restores a record only from the exact plain representation emitted by it.
Record constructors may accept atom-keyed maps, keyword lists and omitted defaults for ergonomic in-memory construction. Durable decoding must be stricter: accepting those alternate shapes would give one semantic record more than one canonical byte representation and digest.
Recursively converts atom map keys to strings without changing atom values.
This is intended for portable, host-authored semantic maps whose ergonomic atom and transport string spellings mean the same thing. It rejects a map containing both spellings instead of silently choosing one. Other portable key types are preserved.
Validates a plain record value within the canonical codec's default resource limits.
Checks a prefix:<lowercase sha256> content-addressed reference.
Checks a required non-empty binary field.
Checks an optional opaque record reference.
Checks an opaque record reference. References are non-empty binaries.
Checks a list of opaque record references.