ledvar-core 0.1.0

Reference implementation of the Ledvar protocol: data model, canonical content-addressed hashing, and well-formedness.
Documentation
//! `ledvar-core` — the reference implementation of the **Ledvar protocol** core:
//! the data model, the canonical content-addressed hashing, and well-formedness.
//!
//! The crate is deliberately **domain-blind** (it knows nothing about security,
//! cloud, or any domain) and **dependency-light** (`serde` for the wire model,
//! `sha2` for hashing — nothing else). Hashing streams the canonical bytes
//! straight into SHA-256 with no intermediate allocation; see the design note in
//! `docs/canonical-hashing.md`.
//!
//! ```
//! use ledvar_core::Node;
//! use std::collections::{BTreeMap, BTreeSet};
//!
//! let mut content = BTreeMap::new();
//! content.insert("grants".to_string(), BTreeSet::from(["SELECT".into(), "INSERT".into()]));
//! content.insert("risk".to_string(), BTreeSet::from(["Medium".into()]));
//! let node = Node {
//!     path: vec!["mydb".into(), "user:app".into()],
//!     content,
//!     labels: BTreeMap::new(),
//!     refs: Vec::new(),
//! };
//! assert_eq!(node.identity_key().unwrap(), "8e303e0e8139ff7d377e0eaf9097e2790071f9914bc7cf8b28020bb98a3cca95");
//! assert_eq!(node.content_hash().unwrap(), "296190489d577d410f0f7fa09dfa24660722227fe405daaf621f4e2666bf370f");
//! ```

#![forbid(unsafe_code)]
#![warn(missing_docs)]

mod canon;
mod error;
mod model;
mod version;
mod wellformed;

pub use canon::canonical_json_string;
pub use error::Error;
pub use model::{Node, Ref, SUPPORTED_PROTOCOL_MAJOR, SUPPORTED_PROTOCOL_MINOR, Snapshot};
pub use version::{parse, parse_major};
pub use wellformed::{validate, validate_node};