MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / canonicalize

Function canonicalize

atomic-canonical/src/jcs.rs:123–129  ·  view source on GitHub ↗

Canonicalize a JSON value into its RFC-8785 string form.

(value: &Value)

Source from the content-addressed store, hash-verified

121
122/// Canonicalize a JSON value into its RFC-8785 string form.
123pub fn canonicalize(value: &Value) -> String {
124 // Infallible for a `Value`: there is no writer to fail against, every
125 // member name is already a Rust `String`, and the delegate's only other
126 // error path is a non-finite float, which `Value` cannot hold. This mirrors
127 // the expectation the hand-written string helper carried before it.
128 serde_json_canonicalizer::to_string(value).expect("canonicalizing a Value is infallible")
129}
130
131#[cfg(test)]
132mod tests {

Callers 15

triage_referenceFunction · 0.70
encode_for_transportFunction · 0.70
content_hashFunction · 0.70
signing_bytesMethod · 0.70
signing_bytesMethod · 0.70
prepare_attestationFunction · 0.70
verify_valueFunction · 0.70
detect_sourceFunction · 0.50
write_and_open_htmlFunction · 0.50
write_and_open_htmlFunction · 0.50
canonical_or_rawFunction · 0.50

Calls

no outgoing calls