Skip to main content

Crate acdp_jcs

Crate acdp_jcs 

Source
Expand description

JSON Canonicalization Scheme (JCS) — RFC 8785.

Implemented inline to avoid an external dependency and to guarantee correct handling of all edge cases, especially:

  • Object key sorting (RFC 8785 §3.2.1 UTF-16 code-unit order; all ACDP keys are ASCII, where this coincides with byte/str order)
  • No whitespace
  • Negative zero (-0.0) MUST become 0 (the most common bug)
  • Non-ASCII characters emitted as-is, not \uXXXX-escaped

Functions§

canonicalize
Canonicalize any serializable value to JCS bytes.
canonicalize_value
Canonicalize a pre-parsed serde_json::Value.
try_canonicalize_value
Canonicalize a pre-parsed serde_json::Value, returning an error if nesting exceeds the internal recursion ceiling (MAX_JCS_DEPTH). Prefer this on any path that may canonicalize untrusted / programmatically-built input.