Skip to main content

affinidi_rdf_encoding/
lib.rs

1pub mod error;
2pub mod jsonld;
3pub mod model;
4pub mod nquads;
5pub mod rdfc1;
6
7pub use error::{RdfError, Result};
8pub use model::{
9    BlankNode, Dataset, GraphLabel, Literal, NamedNode, Object, Quad, Subject, rdf, xsd,
10};
11
12/// Convenience: expand a JSON-LD document to RDF, canonicalize via RDFC-1.0,
13/// and return the SHA-256 hash of the canonical N-Quads output.
14pub fn expand_canonicalize_and_hash(document: &serde_json::Value) -> Result<[u8; 32]> {
15    let dataset = jsonld::expand_and_to_rdf(document)?;
16    rdfc1::canonicalize_and_hash(&dataset)
17}