Object PresentationExchange

  • All Implemented Interfaces:

    
    public class PresentationExchange
    
                        

    The PresentationExchange object provides functions for working with Verifiable Credentials and Presentation Definitions during a presentation exchange process.

    • Constructor Detail

    • Method Detail

      • selectCredentials

         final List<String> selectCredentials(Iterable<String> vcJwts, PresentationDefinitionV2 presentationDefinition)

        Selects credentials that satisfy a given presentation definition.

        Parameters:
        vcJwts - Iterable of VCs in JWT format to select from.
        presentationDefinition - The Presentation Definition to match against.
        Returns:

        A list of Verifiable Credentials that satisfy the Presentation Definition.

      • satisfiesPresentationDefinition

         final Unit satisfiesPresentationDefinition(Iterable<String> vcJwts, PresentationDefinitionV2 presentationDefinition)

        Validates a list of Verifiable Credentials (VCs) against a specified Presentation Definition.

        This function ensures that the provided VCs meet the criteria defined in the Presentation Definition. It first checks for the presence of Submission Requirements in the definition and throws an exception if they exist, as this feature is not implemented. Then, it maps the input descriptors in the presentation definition to the corresponding VCs. If the number of mapped descriptors does not match the required count, an exception is thrown.

        Parameters:
        vcJwts - Iterable of VCs in JWT format to validate.
        presentationDefinition - The Presentation Definition V2 object against which VCs are validated.
      • createPresentationFromCredentials

         final PresentationSubmission createPresentationFromCredentials(Iterable<String> vcJwts, PresentationDefinitionV2 presentationDefinition)

        Creates a Presentation Submission in which the list of Verifiable Credentials JWTs (VCs) fulfills the given Presentation Definition. Presentation Definition.

        Parameters:
        vcJwts - Iterable of VCs in JWT format to validate.
        presentationDefinition - The Presentation Definition V2 object against which VCs are validated.
        Returns:

        A PresentationSubmission object.

      • validateDefinition

         final Unit validateDefinition(PresentationDefinitionV2 presentationDefinition)

        Validates whether an object is usable as a presentation definition or not.

        Model as specified in https://identity.foundation/presentation-exchange/#presentation-definition.

        The checks are as follows:

        • Ensures that the presentation definition's ID is not empty.

        • Validates that the name, if present, is not empty.

        • Checks that the purpose, if provided, is not empty.

        • Verifies the uniqueness of all inputDescriptor IDs within the presentation.

        • Ensures that FieldV2 ids are unique across all input descriptors.

        • For each input descriptor, it validates the descriptor using InputDescriptorV2Validator.

        Throws an PexValidationException if the provided object does not conform to the Presentation Definition

      • validateSubmission

         final Unit validateSubmission(PresentationSubmission presentationSubmission)

        Validates whether an object is usable as a presentation submission or not.

        Model as specified in https://identity.foundation/presentation-exchange/#presentation-submission.

        The checks are as follows:

        • Ensures that the presentation submission's id is not empty.

        • Validates that the definitionId is not empty.

        • Validates descriptorMap is a non-empty list.

        • Check for unique inputDescriptor ids at top level

        • Verifies the input descriptor mapping ids are the same on all levels of nesting.

        • Ensures that the path is valid across all levels of nesting

        Throws an PexValidationException if the provided object does not conform to the Presentation Definition