pub struct VerificationPolicy {
pub validate_body_schema: bool,
pub allow_unknown_status: bool,
pub receipts: ReceiptPolicy,
pub historical_keys: HistoricalKeyPolicy,
pub lineage_head: LineageHeadPolicy,
pub revocations: RevocationPolicy,
}Expand description
Consumer-tunable strictness for VerifiedContext::fetch_with_policy,
VerifiedContext::fetch_current_with_policy, and the
fetch_report* family (VerifiedContext::fetch_report,
VerifiedContext::fetch_report_with_fetcher,
VerifiedContext::fetch_report_diagnose). All three surfaces
consult the same policy fields through the same verify_retrieved
spine — but they do not always agree, because
VerifiedContext::fetch_report_diagnose differs in more than just
how a failure surfaces:
VerifiedContext::fetch_reportandVerifiedContext::fetch_report_with_fetcherrunverify_retrieveddirectly once their own top-level probes pass, and surface a phase failure asErr.VerifiedContext::fetch_report_diagnoseruns its own independent, strict, assertionMethod-only signature probe first (recorded asVerificationReport::signature_ok). That probe has no historical-key fallback and runs beforeverify_retrievedis ever invoked. If it fails,diagnosewithholds theVerifiedContexthandle withpolicy_phase_error: None— the spine never ran, so there is no phase error to record — even in cases whereverify_retrieveditself, as run byfetch_report, would have accepted the key historically under the defaulthistorical_keys: HistoricalKeyPolicy::AcceptWithReceiptplus a verified receipt. Concretely: for a key rotated out ofassertionMethodwith a valid receipt,fetch_reportreturnsOkwithKeyAuthorization::HistoricallyAuthorized, whilediagnosereturns no handle at all for the same input and policy. Only oncediagnose’s own probes all pass does it fall through toverify_retrievedand, from that point on, withhold the handle / recordVerificationReport::policy_phase_errorinstead of returningErr— that part of the behavior is shared with the other two.
For ACDP v0.1.0 the verification profile is always strict:
did:webis required for every producer identity — enforced unconditionally byverify_signature_envelope(RFC-ACDP-0001 §5.4), regardless of any policy field.- Embedded
DataRefhashes are verified byacdp_validation::validate_bodywhenevervalidate_body_schemais set.
Only the fields below have real effect in this version; there are no
relaxed-mode did:web or embedded-hash knobs.
Fields§
§validate_body_schema: boolIf true, run acdp_validation::validate_body (structural
schema checks plus embedded-DataRef hash verification) before
any cryptographic check. Default true. Set false only in
diagnostic paths that want to attempt signature verification
despite a body known to fail structural checks.
The fetch_report* family forces this field off unconditionally
on the internal policy it derives from the caller’s — they run
validate_body_structural (schema only) themselves and record
per-DataRef embedded-hash outcomes in
VerificationReport::data_ref_embedded instead of treating a
mismatch as fatal. This field’s value as set by the caller is
otherwise irrelevant to the report family.
allow_unknown_status: boolIf true, accept Status::Other values (degrade to active per
RFC-ACDP-0004 §4.1). When false, reject unknown statuses.
Default true.
receipts: ReceiptPolicyRegistry-receipt handling (ACDP 0.2, RFC-ACDP-0010).
Default ReceiptPolicy::VerifyIfPresent.
historical_keys: HistoricalKeyPolicyHistorical-key handling (ACDP 0.2, WS-B). Default
HistoricalKeyPolicy::AcceptWithReceipt.
lineage_head: LineageHeadPolicyLineage-head receipt handling on /current fetches (ACDP 0.3,
RFC-ACDP-0011). Only consulted by
VerifiedContext::fetch_current_with_policy; plain retrieval
preserves any lineage_head_receipt verbatim without verifying
it. Default LineageHeadPolicy::default. This is the ONE
field on this struct with restricted scope — allow_unknown_status,
receipts, historical_keys, and revocations above and below
are each honored by every entry point that accepts a
VerificationPolicy, including the fetch_report* family.
revocations: RevocationPolicyKey-revocation handling (ACDP 0.3, RFC-ACDP-0014 §7). Default: no known revocations — the phase is inert.
Implementations§
Source§impl VerificationPolicy
impl VerificationPolicy
Sourcepub fn strict_v0_1_0() -> Self
pub fn strict_v0_1_0() -> Self
The v0.1.0 strict verification profile (RFC-ACDP-0001 §5.11, §9.2).
Runs the full §5.11 pipeline: body schema validation, content_hash
recomputation, did:web key resolution, signature verification, and
embedded data_ref.content_hash checks. Returns on the first failure.
This is the only mode covered by the acdp-consumer conformance
profile. Relaxed modes (Diagnostic, UnsafeForTests) are NOT
available in this crate in v0.1.0 — they would be separately-named
opt-ins per §9.2, and are not currently implemented.
NOT identical to Default::default() as of 0.2: the default
policy is receipt-aware (VerifyIfPresent + AcceptWithReceipt),
while this named profile preserves the exact v0.1.0 semantics —
receipts inert (ReceiptPolicy::Ignore) and only
assertionMethod keys accepted
(HistoricalKeyPolicy::Reject). Callers pinned to this
constructor keep v0.1.0 behavior across the 0.2 upgrade.
Trait Implementations§
Source§impl Clone for VerificationPolicy
impl Clone for VerificationPolicy
Source§impl Debug for VerificationPolicy
impl Debug for VerificationPolicy
Source§impl Default for VerificationPolicy
impl Default for VerificationPolicy
impl Eq for VerificationPolicy
Source§impl PartialEq for VerificationPolicy
impl PartialEq for VerificationPolicy
impl StructuralPartialEq for VerificationPolicy
Auto Trait Implementations§
impl Freeze for VerificationPolicy
impl RefUnwindSafe for VerificationPolicy
impl Send for VerificationPolicy
impl Sync for VerificationPolicy
impl Unpin for VerificationPolicy
impl UnsafeUnpin for VerificationPolicy
impl UnwindSafe for VerificationPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.