cmn-substrate
Core library for the Code Mycelial Network protocol. Zero I/O, WASM-compatible.
What it does
- Data models — Spore, Mycelium, Taste, CMN entry structs with serde serialization
- Cryptography — Ed25519 signatures and BLAKE3 content hashing with JCS canonicalization
- Tree hashing — Git-like Merkle tree (blob_tree_blake3_nfc) with Unicode NFC normalization
- URI parsing —
cmn://domain/b3.hashwith domain and URL validation (rejects SSRF) - Schema validation — Embedded JSON Schema (draft 2020-12) for all protocol artifacts
- HTTP client — Optional async client for fetching manifests, mycelium, taste reports (feature-gated)
- Archive extraction — Optional tar+zstd extraction with security hardening (feature-gated)
Features
| Feature | Description |
|---|---|
client |
HTTP client via reqwest |
client-safe-dns |
Client with DNS filtering (adds tokio) |
archive-ruzstd |
Tar extraction with ruzstd (WASM-compatible) |
archive-zstd |
Tar extraction with zstd (native, faster) |
Usage
[]
= "0.1"
# With HTTP client
= { = "0.1", = ["client-safe-dns"] }
use ;
// Parse a CMN URI
let uri = parse_uri?;
// Validate a document against its schema
let doc: Value = from_str?;
validate_schema?;
License
MIT