verify

fun verify(vcJwt: String)

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

This method conforms to wording about VC data model JWT encoding https://www.w3.org/TR/vc-data-model/#jwt-encoding

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

  • exp MUST represent the expirationDate property, encoded as a UNIX timestamp (NumericDate).

  • iss MUST represent the issuer property of a verifiable credential or the holder property of a verifiable presentation.

  • nbf MUST represent issuanceDate, encoded as a UNIX timestamp (NumericDate).

  • jti MUST represent the id property of the verifiable credential or verifiable presentation.

  • sub MUST represent the id property contained in the credentialSubject.

Parameters

vcJwt

The Verifiable Credential in JWT format as a String.

Throws

if the verification fails at any step, providing a message with failure details.

Example:

try {
VerifiableCredential.verify(signedVcJwt)
println("VC Verification successful!")
} catch (e: SignatureException) {
println("VC Verification failed: ${e.message}")
}