pub struct LinkedVpValidator<R, V = DefaultVerifier> { /* private fields */ }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>
impl<R: KeyResolver, V: JwsVerifier> LinkedVpValidator<R, V>
Sourcepub fn new(resolver: R, verifier: V) -> Self
pub fn new(resolver: R, verifier: V) -> Self
A validator resolving keys with resolver and verifying signatures with verifier.
Sourcepub fn from_presentation_validator(
presentations: JwtPresentationValidator<R, V>,
) -> Self
pub fn from_presentation_validator( presentations: JwtPresentationValidator<R, V>, ) -> Self
A validator over presentations, with its status check.
Sourcepub fn presentation_validator(&self) -> &JwtPresentationValidator<R, V>
pub fn presentation_validator(&self) -> &JwtPresentationValidator<R, V>
The presentation validator.
Sourcepub async fn validate(
&self,
jwt: &Jwt,
did: &Did,
options: &LinkedVpValidationOptions,
) -> Result<DecodedPresentation, LinkedVpError>
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.