Skip to main content

Crate dig_urn_protocol

Crate dig_urn_protocol 

Source
Expand description

§dig-urn-protocol

The canonical DIG content-addressing + server-untrusted verification contract — the one definition of how a DIG URN names content and how a blind client turns opaque gateway bytes into verified plaintext, fail-closed.

This crate OWNS (and is the single source of truth for):

  • The urn:dig: scheme + byte-level grammarDigUrn parsing, DigUrn::canonical rendering, and retrieval_key = SHA-256(canonical()) (plus the root-independent content_key = SHA-256(canonical_rootless())) derivation. The grammar module carries the normative ABNF, pinned by the frozen conformance vectors.
  • The resolution INTERFACE — the UrnResolver trait plus ResolveOutcome / ResolveError / ResolveOptions. The contract, not the transport.
  • The browser content-VERIFICATION contractverify: rootless rejection, leaf-binding, path-fold, root-anchoring, gate-then-decrypt, and the u64-bounded chunk split — over crypto primitives INJECTED via verify::ContentCrypto.

§A leaf crate that reimplements no crypto

dig-urn-protocol has NO dig-* dependencies and NO transport (reqwest/tokio). The merkle-fold and AES primitives are supplied by the caller (digstore_core), so this crate can never skew from the canonical read-crypto. It performs only SHA-256 (the retrieval key + the content leaf), which is byte-identical to digstore_core’s.

§Relationship to dig-rpc-protocol

This crate owns addressing + resolution + verification only. It CONSUMES the dig-rpc-protocol PublicRead contract conceptually for the actual fetch, but does not depend on it or duplicate any RPC method — a concrete UrnResolver wires the two together.

Re-exports§

pub use bytes::Bytes32;
pub use bytes::InvalidBytes32;
pub use grammar::CANONICAL_CHAIN;
pub use grammar::DEFAULT_RESOURCE_KEY;
pub use grammar::SALT_QUERY_MARKER;
pub use grammar::URN_ABNF;
pub use grammar::URN_PREFIX;
pub use resolve::ResolveError;
pub use resolve::ResolveOptions;
pub use resolve::ResolveOutcome;
pub use resolve::ResolvedData;
pub use resolve::Result;
pub use resolve::UrnResolver;
pub use urn::DigUrn;
pub use urn::SecretSalt;
pub use urn::UrnParseError;
pub use verify::chunk_ranges;
pub use verify::decrypt;
pub use verify::require_blind_root;
pub use verify::resource_leaf;
pub use verify::verify_and_decrypt;
pub use verify::verify_inclusion;
pub use verify::ContentCrypto;
pub use verify::FoldedProof;

Modules§

bytes
Bytes32 — the crate’s own 32-byte value type.
grammar
The single normative grammar for the DIG URN — the contract every implementation’s parser must conform to.
resolve
The resolution INTERFACE — the UrnResolver trait and its typed outcomes/errors.
urn
DigUrn — the parsed urn:dig: scheme, its canonical form, and retrieval-key derivation.
verify
The browser content-VERIFICATION contract — how a blind client turns opaque gateway bytes into verified plaintext, fail-closed, over INJECTED crypto primitives.

Functions§

version
The crate version (matches Cargo.toml), for compatibility checks.