Object VerifiablePresentation.Companion

    • Constructor Detail

    • Method Detail

      • create

        @JvmOverloads() final VerifiablePresentation create(String type, String holder, Iterable<String> vcJwts, Map<String, Object> additionalData)

        Create a VerifiablePresentation based on the provided parameters.

        Parameters:
        type - The type of the presentation, as a String.
        holder - The holder URI of the presentation, as a String.
        vcJwts - The credentials used in the presentation, as a String.
        additionalData - The presentation data, as a generic mapping Map<String, Any>.
        Returns:

        A VerifiablePresentation instance.

        Example:

            val vp = VerifiablePresentation.create(
              vcJwts = vcJwts,
              holder = holderDid.uri,
              type = "PresentationSubmission",
              additionalData = mapOf("presentation_submission" to presentationSubmission)
            )
      • verify

         final Unit verify(String vpJwt)

        Verifies the integrity and authenticity of a Verifiable Presentation (VP) encoded as a JSON Web Token (JWT).

        This function performs several crucial validation steps to ensure the trustworthiness of the provided VP:

        • Verifies that the vcJwts inside the VP are valid

        • Parses and validates the structure of the JWT.

        • Ensures the presence of critical header elements alg and kid in the JWT header.

        • Resolves the Decentralized Identifier (DID) and retrieves the associated DID Document.

        • Validates the DID and establishes a set of valid verification method IDs.

        • Identifies the correct Verification Method from the DID Document based on the kid parameter.

        • Verifies the JWT's signature using the public key associated with the Verification Method.

        If any of these steps fail, the function will throw a SignatureException with a message indicating the nature of the failure.

        Parameters:
        vpJwt - The Verifiable Presentation in JWT format as a String.