The [vpDataModel] instance representing the core data model of a verifiable presentation.
The holder of the Verifiable Presentation.
The type of the Verifiable Presentation.
The verifiable credentials contained in the Verifiable Presentation.
Signs the verifiable presentation and returns it as a signed JWT.
The sign options used to sign the presentation.
The JWT representing the signed verifiable presentation.
const vpJwt = verifiablePresentation.sign({ did: myDid });
Static
createCreate a [VerifiablePresentation] based on the provided parameters.
The options to use when creating the Verifiable Presentation.
A [VerifiablePresentation] instance.
const vp = await VerifiablePresentation.create({
type: 'PresentationSubmission',
holder: 'did:ex:holder',
vcJwts: vcJwts,
additionalData: { 'arbitrary': 'data' }
})
Static
parseParses a JWT into a [VerifiablePresentation] instance.
The verifiable presentation JWT as a [String].
A [VerifiablePresentation] instance derived from the JWT.
const vp = VerifiablePresentation.parseJwt({ vpJwt: signedVpJwt })
Static
verifyVerifies 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:
alg
and kid
in the JWT header.kid
parameter.If any of these steps fail, the function will throw a [Error] with a message indicating the nature of the failure.
The Verifiable Presentation in JWT format as a [string].
try {
VerifiablePresentation.verify({ vpJwt: signedVpJwt })
console.log("VC Verification successful!")
} catch (e: Error) {
console.log("VC Verification failed: ${e.message}")
}
Error if the verification fails at any step, providing a message with failure details.
Error if critical JWT header elements are absent.
VerifiablePresentation
is a tamper-evident presentation encoded in such a way that authorship of the data can be trusted after a process of cryptographic verification. W3C Verifiable Presentation Data Model.It provides functionalities to sign, verify, and create presentations, offering a concise API to work with JWT representations of verifiable presentations and ensuring that the signatures and claims within those JWTs can be validated.