Skip to main content

PredicateAcceptList

Struct PredicateAcceptList 

Source
pub struct PredicateAcceptList { /* private fields */ }
Expand description

The predicates a verifier accepts. See the module docs.

Implementations§

Source§

impl PredicateAcceptList

Source

pub fn from_iris<I, S>(iris: I) -> Result<Self, DTGCredentialError>
where I: IntoIterator<Item = S>, S: Into<String>,

An accept-list naming exactly these predicate IRIs.

No constraints beyond the match are attached, but a statement under a core predicate (crate::WITNESSED_V1 and the others) is still held to its profile, because that is checked whenever a VSC is parsed or validated.

§Errors

DTGCredentialError::InvalidPredicate for an entry that is not an absolute NFC IRI: a list containing one could never match a well-formed statement, and is more likely a configuration mistake than an intent.

Source

pub fn from_registry( list: &RegistryAcceptList, statuses: &[PredicateStatus], ) -> Result<Self, DTGCredentialError>

An accept-list of the registry entries whose status is one of statuses, each carrying its constraints.

statuses is the verifier’s floor, stated explicitly — &[Candidate, Standard] for the registry’s recommended default. An empty slice accepts nothing.

§Errors

DTGCredentialError::InvalidPredicate for a key that is not an absolute NFC IRI.

Source

pub fn from_registry_json( json: &str, statuses: &[PredicateStatus], ) -> Result<Self, DTGCredentialError>

PredicateAcceptList::from_registry over the registry’s accept-list.json text.

§Errors

DTGCredentialError::MalformedAcceptList if the document does not have the registry’s shape — including a member this library does not know — and the errors of PredicateAcceptList::from_registry.

Source

pub fn contains(&self, predicate: &str) -> bool

Is predicate accepted, by exact byte comparison?

Source

pub fn iris(&self) -> impl Iterator<Item = &str>

The accepted predicate IRIs.

Source

pub fn entry(&self, predicate: &str) -> Option<&AcceptListEntry>

The registry constraints attached to predicate, if it is accepted and the list was built from the registry.

Source

pub fn len(&self) -> usize

How many predicates are accepted.

Source

pub fn is_empty(&self) -> bool

Does this list accept nothing?

Source

pub fn accept<'a>( &self, vsc: &'a DTGCredential, ) -> Result<&'a str, DTGCredentialError>

Accepts vsc or says why not, failing closed. Returns the accepted predicate.

In order:

  1. vsc must be a StatementCredential, else DTGCredentialError::WrongCredentialType.
  2. It must pass DTGCredential::validate — well-formed predicate, the core profile where there is one, the window’s ordering and the JSON depth bound.
  3. Its predicate must be in this list, byte for byte, else DTGCredentialError::PredicateNotAccepted.
  4. Where the entry carries registry constraints, they must hold: the object kind (DTGCredentialError::ProfileViolation), taskContext and taskDigestMultibase (DTGCredentialError::MissingTaskContext, DTGCredentialError::MissingTaskDigest), the minimum issuerScope (DTGCredentialError::IssuerScopeTooNarrow) and every REQUIRED additional member (DTGCredentialError::ProfileViolation).
§What this does not check

The proof, whether the window contains the present instant, revocation, whether the issuer is one the verifier trusts for this predicate, and any subject–object rule needing the credential the object names — DTGCredential::witnesses_issuance_of and DTGCredential::witnesses_presentation_of are those. Nor does acceptance widen what a statement means: a VSC attests and never establishes, and a verifier MUST NOT draw a conclusion its profile does not state.

Trait Implementations§

Source§

impl Clone for PredicateAcceptList

Source§

fn clone(&self) -> Self

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 PredicateAcceptList

Source§

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

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

impl Default for PredicateAcceptList

Source§

fn default() -> Self

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

impl Eq for PredicateAcceptList

Source§

impl PartialEq for PredicateAcceptList

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PredicateAcceptList

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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