Portable deterministic SPCV v1 values for GAM, using the shared Spectre codec.
Maps use canonical key order and decoding never creates atoms. Structs require
:allowed_structs; processes, references, functions and improper lists are
rejected. The GAM encoder checks its byte budget incrementally, before
allocating the final binary. validate/2 checks the same budget without
constructing that binary.
Summary
Functions
Decodes canonical bytes, rejecting trailing data, aliases and disallowed structs.
Returns the lowercase SHA-256 digest of a canonical value.
Returns the digest or raises ArgumentError for a non-canonical value.
Returns the digest algorithm used by digest/2.
Encodes a value into the versioned canonical binary format.
Encodes a value or raises ArgumentError with the stable failure reason.
Checks whether a value can be represented within this codec's limits.
Returns the canonicalization format version.
Types
@type reason() :: Spectre.Canonical.Value.reason()
Functions
Decodes canonical bytes, rejecting trailing data, aliases and disallowed structs.
Returns the lowercase SHA-256 digest of a canonical value.
Returns the digest or raises ArgumentError for a non-canonical value.
@spec digest_algorithm() :: :sha256
Returns the digest algorithm used by digest/2.
Encodes a value into the versioned canonical binary format.
Options: :allowed_structs, :max_bytes (including the header), :max_depth
and :max_collection_size. See Spectre.Canonical.Value.encode/2.
Encodes a value or raises ArgumentError with the stable failure reason.
Checks whether a value can be represented within this codec's limits.
@spec version() :: pos_integer()
Returns the canonicalization format version.