pub struct SpecPolicy {
pub is_bearer: bool,
pub is_proof_required: bool,
pub is_recipient_required: bool,
pub is_issued_at_required: bool,
}Expand description
The flag-driven consumer policy a Trust Task specification declares, read
off a generated Payload impl.
TrustTask::enforce_spec_policy is
the typed entry point and stays the one most consumers want. This type
exists for the other shape: a consumer that dispatches on the Type URI and
holds a TrustTask<serde_json::Value>, so it has no P to read the
constants from. schema_index::spec_policy_for
hands it one keyed by URI.
Both paths run SpecPolicy::enforce, so they cannot diverge on the check
set as new flag-driven rules are added — which is the whole reason this is a
value rather than four public constants for a caller to re-apply by hand.
Fields§
§is_bearer: boolPayload::IS_BEARER — the spec opts out of §4.8.2 audience binding.
is_proof_required: boolPayload::IS_PROOF_REQUIRED — §7.3 item 8.
is_recipient_required: boolPayload::IS_RECIPIENT_REQUIRED — §7.2 item 5b.
is_issued_at_required: boolPayload::IS_ISSUED_AT_REQUIRED — §7.3 item 17.
Implementations§
Source§impl SpecPolicy
impl SpecPolicy
Sourcepub const fn of<P>() -> SpecPolicywhere
P: Payload,
pub const fn of<P>() -> SpecPolicywhere
P: Payload,
Read the policy off a generated payload type.
Sourcepub fn enforce<P>(&self, doc: &TrustTask<P>) -> Result<(), RejectReason>
pub fn enforce<P>(&self, doc: &TrustTask<P>) -> Result<(), RejectReason>
Apply the checks to a document’s envelope.
Generic over the payload type and never reads it: every rule here is
about recipient, proof and issuedAt. That is what lets a
URI-dispatching consumer run the full check set against a
TrustTask<serde_json::Value> without first deserializing into the
generated type.
Trait Implementations§
Source§impl Clone for SpecPolicy
impl Clone for SpecPolicy
Source§fn clone(&self) -> SpecPolicy
fn clone(&self) -> SpecPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SpecPolicy
Source§impl Debug for SpecPolicy
impl Debug for SpecPolicy
impl Eq for SpecPolicy
Source§impl PartialEq for SpecPolicy
impl PartialEq for SpecPolicy
impl StructuralPartialEq for SpecPolicy
Auto Trait Implementations§
impl Freeze for SpecPolicy
impl RefUnwindSafe for SpecPolicy
impl Send for SpecPolicy
impl Sync for SpecPolicy
impl Unpin for SpecPolicy
impl UnsafeUnpin for SpecPolicy
impl UnwindSafe for SpecPolicy
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> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ResourceProvider<()> for T
impl<T> ResourceProvider<()> for T
Source§fn get_resource(&self) -> &()
fn get_resource(&self) -> &()
T.