The Presentation Exchange (PEX) Library implements the functionality described in the DIF Presentation Exchange specification

Constructors

Properties

pex: PEX = ...

The Presentation Exchange (PEX) instance.

Methods

  • Creates a presentation from a list of Verifiable Credentials that satisfy a given presentation definition. This function initializes the Presentation Exchange (PEX) process, validates the presentation definition, evaluates the credentials against the definition, and finally constructs the presentation result if the evaluation is successful.

    Parameters

    • params: {
          presentationDefinition: PresentationDefinitionV2;
          vcJwts: string[];
      }

      The parameters for the presentation creation.

      • presentationDefinition: PresentationDefinitionV2

        The Presentation Definition V2 to match the VCs against.

      • vcJwts: string[]

        The list of Verifiable Credentials (VCs) in JWT format to be evaluated.

    Returns PresentationResult

    The result of the presentation creation process, containing a presentation submission that satisfies the presentation definition criteria.

    Throws

    If the evaluation results in warnings or errors, or if the required credentials are not present, an error is thrown with a descriptive message.

  • Evaluates a presentation against a presentation definition.

    Parameters

    Returns EvaluationResults

    The result of the evaluation process.

  • Resets the PEX instance.

    Returns void

  • Validates if a list of VC JWTs satisfies the given presentation definition.

    Parameters

    • params: {
          presentationDefinition: PresentationDefinitionV2;
          vcJwts: string[];
      }

      The parameters for the satisfaction check.

      • presentationDefinition: PresentationDefinitionV2

        The criteria to validate against.

      • vcJwts: string[]

        An array of VC JWTs as strings.

    Returns void

    Throws

    Error if the evaluation results in warnings or errors.

  • Selects credentials that satisfy a given presentation definition.

    Parameters

    • params: {
          presentationDefinition: PresentationDefinitionV2;
          vcJwts: string[];
      }

      The parameters for the credential selection.

      • presentationDefinition: PresentationDefinitionV2

        The Presentation Definition to match against.

      • vcJwts: string[]

        The list of Verifiable Credentials to select from.

    Returns string[]

    selectedVcJwts A list of Verifiable Credentials that satisfy the Presentation Definition.

  • This method validates whether an object is usable as a presentation definition or not.

    Parameters

    Returns Validated

    the validation results to reveal what is acceptable/unacceptable about the passed object to be considered a valid presentation definition

  • This method validates whether an object is usable as a presentation submission or not.

    Parameters

    • presentationSubmission: {
          presentationSubmission: PresentationSubmission;
      }

      the object to be validated.

      • presentationSubmission: PresentationSubmission

    Returns Validated

    the validation results to reveal what is acceptable/unacceptable about the passed object to be considered a valid presentation submission