OpenAgentID documentation
Source referencesRust module referenceopenagent-crypto-wasm

openagent-crypto-wasm · jcs

Declared module signatures, types, configuration, and source documentation.

Source: openagent-sdk/crates/openagent-crypto-wasm/src/jcs.rs. SHA-256: 06d4f1069cf4f1bd1e99da710961198c3c22f15031fbecadd0bf8ff84a3cfbe6.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

jcs::canonicalize

Canonicalizes a UTF-8 JSON string into its JCS bytes.

input MUST be a valid JSON document. Invalid JSON returns [CryptoError::JcsFailed].

Examples

let bytes = openagent_crypto_wasm::jcs::canonicalize(r#"{"b":1,"a":2}"#).unwrap();
assert_eq!(bytes, br#"{"a":2,"b":1}"#);
pub fn canonicalize(input: &str) -> Result<Vec<u8>, CryptoError>;

Source line: 26.

jcs::canonicalize_value

Canonicalizes a [serde_json::Value] into its JCS bytes.

Use this when you already have a parsed serde_json::Value (e.g. from a downstream Rust crate) so you don't pay the cost of re-parsing.

pub fn canonicalize_value(value: &serde_json::Value) -> Result<Vec<u8>, CryptoError>;

Source line: 38.

On this page