open-standards/smart-byte/smart-byte-rs/crates/smart-byte-acdc/src/lib.rs
Transaction Science 68b8a2dbee ingest wave F: 3 crates · op-crypto-extra + smart-byte-acdc + eoc-memory
OpenPay (1 crate, 3751 LOC, 83 tests)
  op-crypto-extra      Extended crypto rails. Stablecoin catalog (USDC, USDT,
                       PYUSD, DAI, RLUSD, EURC, FDUSD — 26 deployments). L2
                       catalog (12 chains incl. Optimism, Arbitrum, Base,
                       zkSync Era, Polygon zkEVM, Linea, Scroll, Starknet).
                       CCTP v2 BurnMessage encode/decode + domain ids +
                       attestation. ERC-4337 UserOperation v0.7 +
                       PackedUserOperation. EIP-7702 set-EOA-code with RLP
                       signing preimage. Uniswap Permit2 single + batch
                       transfer EIP-712 hashes. EIP-2612 ERC-20 permit.
                       BOLT-11 bech32 invoices + LNURL decode. Bitcoin
                       PSBT v2 (BIP-370). Atomic-swap HTLC. Solana SPL /
                       Aleo / Aztec confidential-transfer sketches.

Smart Byte (1 crate, 2304 LOC, 30 tests)
  smart-byte-acdc      Authentic Chained Data Containers (KERI ecosystem).
                       Acdc + AcdcBuilder (targeted + untargeted) with SAID
                       derivation. JSON Schema 2020-12 validator with
                       oneOf partial-disclosure. TEL (RIP/VRT/ISS/REV)
                       with hash-chained verification. IPEX (apply/offer/
                       agree/grant/admit/spurn) chained by SAID. Edge
                       records (I2I/NI2I/DI2I) + EdgeGraph BFS traversal
                       with cycle detection. Selective disclosure with
                       full/none/subset plans + compact packing.
                       CredentialRegistry trait + InMemoryRegistry over
                       TEL. Composes with smart-byte-core + smart-byte-keri-witness.

EOC (1 crate, 1764 LOC, 16 tests)
  eoc-memory           Long-term memory primitives. Memory trait + MemoryKind +
                       EpisodeId. Episodic event log with TimeIndex range
                       queries. RDF-style Triple store with S/P/O indices.
                       Bounded attention-budget Scratchpad with
                       salience-weighted eviction. Rolling SummaryBuffer +
                       FIFO SlidingWindow. Dream-cycle consolidate()
                       (episodic → semantic). Ebbinghaus forgetting curve
                       with reinforcement. Retriever blending cosine
                       similarity + recency + saturating frequency.
                       MemGpt three-tier shape (Main/Recall/Archival).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-05-24 17:28:24 -04:00

71 lines
3.2 KiB
Rust

//! # smart-byte-acdc
//!
//! Authentic Chained Data Containers (ACDC) — a verifiable credential
//! format from the KERI ecosystem, ingested into the Smart Byte
//! substrate as an Apache-2.0 Rust reference implementation.
//!
//! The format originates with Smith's *Authentic Chained Data
//! Containers* draft (IETF `draft-ssmith-acdc`) and is the credential
//! companion to KERI's identifier layer. Where [`smart_byte_vc`]
//! ingests the W3C VCDM family, this crate ingests the KERI-native
//! family:
//!
//! * [`acdc::Acdc`] — the credential body with `issuer`, `schema`,
//! `registry`, attribute, and edge sections, each anchored by a
//! SAID per spec §3.
//! * [`schema`] — ACDC's JSON-Schema-dialect validator, including
//! support for the `oneOf` partial-disclosure construction used by
//! selective disclosure.
//! * [`tel`] — Transaction Event Log carrying `RIP` (registry
//! inception), `VRT` (registry rotation), `ISS` (credential
//! issuance), and `REV` (revocation) events.
//! * [`ipex`] — Issuance / Presentation Exchange messages (`grant`,
//! `admit`, `apply`, `offer`, `agree`, `spurn`) used to move ACDCs
//! between controllers.
//! * [`edge`] — the edge section linking one ACDC to another by SAID,
//! plus an in-memory graph + traversal utility.
//! * [`selective`] — selective disclosure derived from
//! partially-disclosable schemas; an attribute section is split into
//! a SAIDed digest tree and a holder may reveal a subset while
//! preserving the credential's overall SAID.
//! * [`registry`] — a [`registry::CredentialRegistry`] trait plus an
//! in-memory implementation tying credentials to their TEL.
//!
//! ACDC composes directly with the rest of the substrate: SAIDs come
//! from [`smart_byte_core::Said`] and the witness layer in
//! [`smart_byte_keri_witness`] can counter-sign TEL anchoring events
//! the same way it counter-signs KEL events.
#![forbid(unsafe_code)]
#![deny(missing_docs)]
pub mod acdc;
pub mod edge;
pub mod error;
pub mod ipex;
pub mod registry;
pub mod schema;
pub mod selective;
pub mod tel;
pub use acdc::{Acdc, AcdcBuilder, AttributeSection, EdgeSection, RegistrySection, SchemaSection};
pub use edge::{Edge, EdgeGraph, EdgeOp};
pub use error::{AcdcError, Result};
pub use ipex::{IpexKind, IpexMessage};
pub use registry::{CredentialRegistry, InMemoryRegistry, RegistryState};
pub use schema::{AcdcSchema, SchemaDialect, SchemaType, validate_attributes};
pub use selective::{DisclosurePlan, SelectiveDisclosure, derive_disclosure};
pub use tel::{Tel, TelEvent, TelEventKind};
/// Canonical version string carried in every ACDC envelope's `v` field.
///
/// `ACDC10JSON` mirrors the KERI / ACDC versioning convention:
/// four-character family tag, two-digit major.minor, serialization
/// tag. v1.0, canonical JSON via RFC 8785 JCS.
pub const VERSION_STRING: &str = "ACDC10JSON";
/// Placeholder used in the `d` field during SAID derivation. 44
/// characters is the textual length of a base32-no-pad BLAKE3-256
/// digest, ensuring the placeholder occupies the same number of bytes
/// as the final SAID and the JCS encoding's byte layout is stable.
pub const SAID_PLACEHOLDER: &str = "############################################";