Skip to main content

uor_addr/sexp/
mod.rs

1//! **`uor_addr::sexp` — the S-expression realization of UOR-ADDR**
2//! (ARCHITECTURE.md "Format-specific realizations" § `uor-addr-sexp`).
3//!
4//! S-expression typed-input content-addressing under Rivest's canonical
5//! S-expression form, with the σ-projection bound to
6//! `prism::crypto::Sha256Hasher`.
7//!
8//! ## Authoritative sources
9//!
10//! - **Canonical S-expressions** — Ronald L. Rivest, *S-expressions*,
11//!   May 4 1997 draft, archived at
12//!   <https://people.csail.mit.edu/rivest/Sexp.txt>. I-D form at
13//!   <https://datatracker.ietf.org/doc/html/draft-rivest-sexp-00>.
14//! - **SPKI canonical form citation** — IETF RFC 2693 §3
15//!   *SPKI Certificate Theory*
16//!   (<https://datatracker.ietf.org/doc/html/rfc2693#section-3>).
17//! - **SHA-256 σ-projection** — NIST FIPS 180-4
18//!   (<https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf>).
19//!
20//! ## Grammar
21//!
22//! ```text
23//! SExprValue ::= Atom(bytes)            — symbolic atoms (UTF-8 bytes)
24//!              | Cons(SExprValue, SExprValue)
25//!              | Nil
26//! ```
27//!
28//! The wire-format input is canonical S-expression syntax — atoms as
29//! `<n>:<bytes>` length-prefixed byte sequences (Rivest's canonical
30//! form), lists as parenthesized sequences, nil as `()`. The parser also
31//! admits the Lisp-style sugared form `(a b c)`.
32//!
33//! ## Canonicalization (ADR-060 streaming)
34//!
35//! The realization no longer materializes a structurally-tagged byte
36//! form. [`SExprCanon`] is a [`prism::uor_foundation::pipeline::ChunkSource`] over the
37//! borrowed input that emits Rivest canonical bytes on demand — atoms as
38//! `<n>:<bytes>`, lists as `(s₁ s₂ … sₙ)`, nil as `()` — and ψ₉ folds
39//! those chunks through the σ-axis. There is no input size, atom-width,
40//! element-count, or nesting-depth ceiling.
41
42pub mod model;
43pub mod pipeline;
44pub mod value;
45pub mod verbs;
46
47pub use model::{
48    AddressModel, AddressModelBlake3, AddressModelKeccak256, AddressModelSha3_256,
49    AddressModelSha512, AddressRoute,
50};
51pub use pipeline::{
52    address, address_blake3, address_keccak256, address_sha3_256, address_sha512, AddressFailure,
53    AddressOutcome, AddressWitness, VerifyError,
54};
55#[cfg(feature = "alloc")]
56pub use value::canonicalize;
57pub use value::{SExprCanon, SExprValue};
58pub use verbs::{address_inference, VERB_TERMS_ADDRESS_INFERENCE};
59
60/// The shared, format-independent ψ-tower (re-exported for convenience;
61/// canonical path is [`crate::resolvers::AddressResolverTuple`]).
62pub use crate::resolvers::AddressResolverTuple;