CharterAgreementProtocol. Canonicalization
(Charter Agreement Protocol v0.1.0)
Copy Markdown
View Source
CAP never authorizes.
RFC 8785 JSON Canonicalization Scheme over the protocol's tagged JSON algebra.
Object names sort by unsigned UTF-16 code units, strings use the exact JSON
control-byte escape grammar, numbers use ECMAScript shortest-round-trip
spelling, and output is UTF-8 without inter-token whitespace. verify/1
accepts received bytes only when decode→re-encode is byte-identical.
Summary
Functions
Encode a tagged JSON value as canonical UTF-8 JSON.
Serialize a float using ECMAScript shortest-round-trip spelling.
Verify that received JSON bytes are already canonical.
Functions
@spec encode(term()) :: {:ok, binary()} | {:error, CharterAgreementProtocol.Error.t()}
Encode a tagged JSON value as canonical UTF-8 JSON.
@spec number(term()) :: {:ok, binary()} | {:error, CharterAgreementProtocol.Error.t()}
Serialize a float using ECMAScript shortest-round-trip spelling.
@spec verify(term()) :: {:ok, CharterAgreementProtocol.Json.value()} | {:error, CharterAgreementProtocol.Error.t()}
Verify that received JSON bytes are already canonical.