Skip to main content

Module predicates

Module predicates 

Source
Expand description

Predicate registry: typed, schema-validated payloads for Treeship receipts.

A Treeship receipt (treeship/receipt/v1) carries a free-form kind and an opaque JSON payload. The predicate registry makes specific kind values typed: each registered suffix is bound to a JSON Schema, and at attest time the payload is validated against that schema before the receipt is signed (validate). A registered predicate that fails validation is rejected, so a downstream verifier can rely on the shape, not just the signature.

This is purely additive and backward compatible. A kind with no registered schema attests exactly as before (sign-on-submit); existing artifact types, signing logic, and chain structure are untouched.

§Validation depth, deliberately

Core does a small, dependency-free structural check: every required field is present and each present field whose schema declares a primitive type matches that type (including union types like ["string","null"]). That is the complete contract for the flat memory.write.v1 / memory.read.v1 predicates, which use only required + type.

boundary.v1 is a richer JSON Schema (const/enum/pattern/$ref). Core enforces its required-field/type structure and ships the full schema as the canonical published artifact (schema_json("boundary.v1")); the complete constraint set is delegated to that schema for external validators. We keep the core validator dependency-free on purpose: pulling a full JSON-Schema engine (and its transitive surface) into the security-critical signing crate, and into the WASM verifier build, is not worth it for an attest-time check.

Enums§

PredicateError
A payload that does not conform to its predicate schema.

Functions§

registered_suffixes
Every registered predicate suffix.
schema_json
Returns the raw JSON Schema text for a registered predicate suffix, if any. This is the canonical published schema for the predicate.
validate
Validate a receipt payload against the registered schema for suffix.