Skip to main content

Crate knobe

Crate knobe 

Source
Expand description

KNOBE Protocol v1 in Rust: a verifier that reproduces lens.py (the reference) verdict-for-verdict, and a sealer that reproduces knobe-core.js createKnobe byte-for-byte.

A match proves integrity, not truth. A valid proves conformance, not truth. Inspect before trusting.

Re-exports§

pub use json::Value;
pub use seal::CreateOptions;
pub use seal::Created;
pub use seal::SealError;
pub use seal::UNICODE_VERSION;
pub use seal::create_knobe;
pub use seal::seal;
pub use verify::Report;
pub use verify::verify_bytes;
pub use verify::verify_path;

Modules§

canon
Spec §5 canonical form and hashes — FROZEN for v1.
json
Strict JSON (RFC 8259) as lens.py reads a payload: Python’s json.loads with lens.py’s hooks. Duplicate keys at any depth are rejected (when their object closes, as object_pairs_hook sees them), and so are NaN/Infinity and a float that overflows to infinity (e.g. 1e400, as lens.py since PR #11). Integers keep every digit like Python’s int, up to its 4300-digit limit, and objects keep insertion order.
pyfmt
Python-compatible text behaviour that the reference verifier (lens.py) depends on: str.isspace()/strip(), float repr(), repr() of values, truthiness, and the safe() terminal-escaping helper. Also the JavaScript \s set, which createKnobe uses when writing a body.
seal
The sealer: a port of knobe-core.js seal() / createKnobe(). For any input createKnobe accepts and emits a self-consistent file from, the output here is byte-identical.
verify
The verifier: a port of lens.py verify(). It reports two independent dimensions, state (integrity) and conformance (schema/spec), plus body_verified for the optional body hash.

Constants§

SUPPORTED_SPEC_VERSIONS
Spec versions this implementation can honestly verify.