Skip to main content
Version: 1.3

Class: JwtPresentationValidator

identity_wasm.JwtPresentationValidator

Table of contents

Constructors

Methods

Constructors

constructor

new JwtPresentationValidator(signatureVerifier?)

Creates a new JwtPresentationValidator. If a signatureVerifier is provided it will be used when verifying decoded JWS signatures, otherwise a default verifier capable of handling the EdDSA, ES256, ES256K algorithms will be used.

Parameters

NameType
signatureVerifier?IJwsVerifier

Methods

toJSON

toJSON(): Object

  • Return copy of self without private attributes.

Returns

Object


toString

toString(): string

Return stringified version of self.

Returns

string


validate

validate(presentationJwt, holder, validation_options): DecodedJwtPresentation

Validates a Presentation encoded as a Jwt.

The following properties are validated according to options:

  • the JWT can be decoded into a semantically valid presentation.
  • the expiration and issuance date contained in the JWT claims.
  • the holder's signature.

Validation is done with respect to the properties set in options.

Warning

  • This method does NOT validate the constituent credentials and therefore also not the relationship between the credentials' subjects and the presentation holder. This can be done with JwtCredentialValidationOptions.
  • The lack of an error returned from this method is in of itself not enough to conclude that the presentation can be trusted. This section contains more information on additional checks that should be carried out before and after calling this method.

The state of the supplied DID Documents.

The caller must ensure that the DID Documents in holder are up-to-date.

Errors

An error is returned whenever a validated condition is not satisfied or when decoding fails.

Parameters

NameType
presentationJwtJwt
holderIToCoreDocument | CoreDocument
validation_optionsJwtPresentationValidationOptions

Returns

DecodedJwtPresentation


checkStructure

Static checkStructure(presentation): void

Validates the semantic structure of the Presentation.

Parameters

NameType
presentationPresentation

Returns

void


extractHolder

Static extractHolder(presentation): CoreDID

Attempt to extract the holder of the presentation.

Errors:

  • If deserialization/decoding of the presentation fails.
  • If the holder can't be parsed as DIDs.

Parameters

NameType
presentationJwt

Returns

CoreDID