Expand description
Runtime validation against the ACDP schemas.
The JSON schemas are the single source of truth for wire-shape constraints, but JSON Schema cannot express every invariant in the ACDP RFCs. This module implements the runtime checks the schema delegates to producers and registries:
- String length / array uniqueness / array size limits
data_period.start <= endDataRefoneOf (location XOR embedded), URI credential rejection, structured-locator scheme pattern, embedded size cap, embeddedcontenttyping per encodingmetadataruntime depth / JCS-size / property-count capsagent_idDID pattern +did:webenforcement (v0.1.0)- Signature value length per algorithm
- Embedded
content_hashcomputation and verification - Identifier pattern validation (
ctx_id,lineage_id,content_hash)
Each function is independently usable; validate_publish_request and
validate_body aggregate everything for end-to-end validation.
Functions§
- compute_
embedded_ hash - Compute the SHA-256
ContentHashof decoded embedded content. - embedded_
decoded_ bytes - Decode an
EmbeddedContentto its canonical byte form peracdp-data-ref.schema.jsoncontent_hashsemantics: - validate_
body - Validate a stored
Body(retrieval-side check). - validate_
body_ structural - Same as
validate_bodybut skips the embedded-content_hashrecomputation. - validate_
capabilities - Validate a
acdp_types::CapabilitiesDocumentagainst the runtime constraints listed in RFC-ACDP-0007 §3. - validate_
data_ ref - Validate a single
DataRefagainstacdp-data-ref.schema.jsonand the runtime invariants the schema delegates. - validate_
data_ ref_ structural - Same as
validate_data_refbut skips the embedded-content_hashrecomputation. Callers that want to report per-DataRefhash failures (e.g.acdp::client::VerifiedContext::fetch_report) run the structural checks via this helper, then callverify_embedded_hashthemselves and record the outcome instead of short-circuiting. - validate_
extensions - Validate the flattened forward-compatibility
extensionsobject with the same property-count / depth / JCS-size caps asmetadata. - validate_
identifiers - Validate an identifier triple — convenient for retrieval-side use.
- validate_
metadata - Validate
metadata’s runtime invariants per RFC-ACDP-0002 §3.3: max 100 top-level properties, max 8 nesting levels, max 64 KB JCS size. - validate_
publish_ request - Validate a complete
PublishRequestagainst every schema constraint and runtime invariant. - verify_
embedded_ hash - Verify a
DataRef’s declaredcontent_hashagainst its embedded payload. Does nothing if the ref has nocontent_hashor noembedded.