uor_addr/json/mod.rs
1//! **`uor_addr::json` — the JSON realization of UOR-ADDR**
2//! (ARCHITECTURE.md "Format-specific realizations" § `uor-addr-json`).
3//!
4//! JSON typed-input content-addressing under JCS-RFC8785 §3 + Unicode
5//! NFC, with the σ-projection bound to `prism::crypto::Sha256Hasher`.
6//!
7//! ## Authoritative sources
8//!
9//! - **JSON syntax** — IETF RFC 8259 *The JavaScript Object Notation
10//! (JSON) Data Interchange Format*
11//! (<https://datatracker.ietf.org/doc/rfc8259/>).
12//! - **Canonical form (JCS)** — IETF RFC 8785 *JSON Canonicalization
13//! Scheme (JCS)* (<https://datatracker.ietf.org/doc/rfc8785/>).
14//! - **Unicode NFC normalization** — Unicode Standard Annex #15
15//! *Unicode Normalization Forms* (<https://www.unicode.org/reports/tr15/>).
16//! - **ECMA-262 numeric serialization** — invoked by JCS-RFC8785
17//! §3.2.2.3 (<https://datatracker.ietf.org/doc/html/rfc8785#section-3.2.2.3>).
18//! - **SHA-256 σ-projection** — NIST FIPS 180-4
19//! (<https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf>).
20//! - **Reference baseline** —
21//! <https://mcp.uor.foundation/tools/encode_address> κ-label fixtures.
22//!
23//! ## End-to-end through prism's typed-iso surface (ADR-060)
24//!
25//! 1. [`canonicalize`] parses raw JSON and emits the JCS-RFC8785 +
26//! Unicode-NFC canonical-form bytes into an `alloc` buffer at the host
27//! boundary (object members sorted by key; no width / count caps).
28//! 2. [`address`] wraps those bytes in the borrowed [`JsonCarrier`] and
29//! runs [`AddressModel`]'s `forward()`: the ψ-chain verb
30//! [`address_inference`] threads the carrier through the shared
31//! [`AddressResolverTuple`] (ADR-036), and ψ₉ folds the canonical
32//! bytes through `Sha256Hasher` in one σ-projection to derive the
33//! κ-label.
34//! 3. [`address`] returns the [`crate::AddressOutcome`] carrying the
35//! [`crate::AddressLabel`] κ-label + replayable TC-05 witness —
36//! well-formed JSON always yields exactly one label.
37//!
38//! ## Why this module exists
39//!
40//! Per ARCHITECTURE.md, UOR-ADDR is **a body of `PrismModel`
41//! declarations** specialized to typed content-addressing across
42//! formats with bounded recursive structural typing. Each format
43//! ships its concrete specialization (this module for JSON;
44//! [`crate::sexp`] for S-expressions; future modules per the
45//! demand-driven clause of ADR-031). The common surface
46//! ([`crate::common`]) names the shared trait, output shape, and
47//! cost-model commitment; each format declares its own concrete
48//! `prism_model!`, `verb!`, and `resolver!` invocations because the
49//! SDK macros emit per-declaration types.
50
51pub mod model;
52pub mod pipeline;
53pub mod shapes;
54pub mod value;
55pub mod verbs;
56
57pub use model::{
58 AddressModel, AddressModelBlake3, AddressModelKeccak256, AddressModelSha3_256,
59 AddressModelSha512, AddressRoute,
60};
61#[cfg(feature = "alloc")]
62pub use pipeline::{address, address_blake3, address_keccak256, address_sha3_256, address_sha512};
63pub use pipeline::{AddressFailure, AddressOutcome, AddressWitness, VerifyError};
64pub use shapes::{Sha256Hasher, MAX_JSON_DEPTH};
65pub use value::JsonCarrier;
66#[cfg(feature = "alloc")]
67pub use value::{canonicalize, ArrayIter, JsonValue, JsonValueRef, ObjectIter};
68pub use verbs::{address_inference, VERB_TERMS_ADDRESS_INFERENCE};
69
70/// The shared `AddrBounds` capacity profile (re-exported for the wiki
71/// cross-references; canonical path is [`crate::bounds::AddrBounds`]).
72pub use crate::bounds::AddrBounds;
73/// The shared, format-independent ψ-tower (re-exported for convenience;
74/// canonical path is [`crate::resolvers::AddressResolverTuple`]).
75pub use crate::resolvers::AddressResolverTuple;