Skip to main content

VerificationPolicy

Struct VerificationPolicy 

Source
pub struct VerificationPolicy {
    pub validate_body_schema: bool,
    pub allow_unknown_status: bool,
    pub receipts: ReceiptPolicy,
    pub historical_keys: HistoricalKeyPolicy,
}
Expand description

Consumer-tunable strictness for VerifiedContext::fetch_with_policy.

For ACDP v0.1.0 the verification profile is always strict:

  • did:web is required for every producer identity — enforced unconditionally by verify_signature_envelope (RFC-ACDP-0001 §5.4), regardless of any policy field.
  • Embedded DataRef hashes are verified by acdp_validation::validate_body whenever validate_body_schema is 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: bool

If 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.

§allow_unknown_status: bool

If true, accept Status::Other values (degrade to active per RFC-ACDP-0004 §4.1). When false, reject unknown statuses. Default true.

§receipts: ReceiptPolicy

Registry-receipt handling (ACDP 0.2, RFC-ACDP-0010). Default ReceiptPolicy::VerifyIfPresent.

§historical_keys: HistoricalKeyPolicy

Historical-key handling (ACDP 0.2, WS-B). Default HistoricalKeyPolicy::AcceptWithReceipt.

Implementations§

Source§

impl VerificationPolicy

Source

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

Source§

fn clone(&self) -> VerificationPolicy

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VerificationPolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VerificationPolicy

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for VerificationPolicy

Source§

impl PartialEq for VerificationPolicy

Source§

fn eq(&self, other: &VerificationPolicy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for VerificationPolicy

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more