Skip to main content

LinkedVpValidator

Struct LinkedVpValidator 

Source
pub struct LinkedVpValidator<R, V = DefaultVerifier> { /* private fields */ }
Available on crate feature linked-vp only.
Expand description

Validates linked presentations: JwtPresentationValidator with the options fixed to the specification, plus the holder and the signer being the DID that links the presentation.

§Examples

use identity_kit::jose::DefaultVerifier;
use identity_kit::linked_vp::LinkedVpValidator;
use identity_kit::methods::DidKey;
use identity_kit::resolver::Resolver;

let resolver = Resolver::builder().with(DidKey::default()).build();
let validator = LinkedVpValidator::new(resolver, DefaultVerifier);
assert!(!validator.presentation_validator().credential_validator().has_status_check());

Implementations§

Source§

impl<R: KeyResolver, V: JwsVerifier> LinkedVpValidator<R, V>

Source

pub fn new(resolver: R, verifier: V) -> Self

A validator resolving keys with resolver and verifying signatures with verifier.

Source

pub fn from_presentation_validator( presentations: JwtPresentationValidator<R, V>, ) -> Self

A validator over presentations, with its status check.

Source

pub fn presentation_validator(&self) -> &JwtPresentationValidator<R, V>

The presentation validator.

Source

pub async fn validate( &self, jwt: &Jwt, did: &Did, options: &LinkedVpValidationOptions, ) -> Result<DecodedPresentation, LinkedVpError>

Validates jwt as a presentation linked from the document of did.

The holder, and the party the token’s KeyReference names, are checked against did before any key is resolved, so a presentation naming another DID never makes the resolver fetch that DID’s document: a DID URL must be of did, a key by value must be the did:jwk of did, and a key set of an HTTPS issuer never belongs to a DID.

§Errors

LinkedVpError::HolderMismatch when the holder is not did, otherwise LinkedVpError::Presentation with what JwtPresentationValidator::validate reports; a key of another DID is a ValidationError::HolderMismatch there.

Trait Implementations§

Source§

impl<R: Debug, V: Debug> Debug for LinkedVpValidator<R, V>

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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