Object VerifiablePresentation.Companion
-
- All Implemented Interfaces:
public class VerifiablePresentation.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static VerifiablePresentation.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final VerifiablePresentationcreate(String type, String holder, Iterable<String> vcJwts, Map<String, Object> additionalData)Create a VerifiablePresentation based on the provided parameters. final VerifiablePresentationcreate(String type, String holder, Iterable<String> vcJwts)Create a VerifiablePresentation based on the provided parameters. final VerifiablePresentationcreate(String holder, Iterable<String> vcJwts)Create a VerifiablePresentation based on the provided parameters. final Unitverify(String vpJwt)Verifies the integrity and authenticity of a Verifiable Presentation (VP) encoded as a JSON Web Token (JWT). final VerifiablePresentationparseJwt(String vpJwt)Parses a JWT into a VerifiablePresentation instance. -
-
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) )
-
create
@JvmOverloads() final VerifiablePresentation create(String type, String holder, Iterable<String> vcJwts)
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.- Returns:
A VerifiablePresentation instance.
Example:
val vp = VerifiablePresentation.create( vcJwts = vcJwts, holder = holderDid.uri, type = "PresentationSubmission", additionalData = mapOf("presentation_submission" to presentationSubmission) )
-
create
@JvmOverloads() final VerifiablePresentation create(String holder, Iterable<String> vcJwts)
Create a VerifiablePresentation based on the provided parameters.
- Parameters:
holder- The holder URI of the presentation, as a String.vcJwts- The credentials used in the presentation, as a String.- 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
algandkidin 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
kidparameter.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.
-
parseJwt
final VerifiablePresentation parseJwt(String vpJwt)
Parses a JWT into a VerifiablePresentation instance.
- Parameters:
vpJwt- The verifiable credential JWT as a String.- Returns:
A VerifiablePresentation instance derived from the JWT.
Example:
val vp = VerifiablePresentation.parseJwt(signedVpJwt)
-
-
-
-