The verifyPresentation function is an asynchronous method designed to validate the authenticity and integrity of a Verifiable Presentation (VP). This function ensures that the VP contains valid proofs, that the credentials included in the presentation are not revoked or expired, and that the presentation adheres to the required standards and criteria set forth for verification.

Features

  • Comprehensive Checks: Verifies all aspects of the presentation, including the validity of cryptographic proofs, the non-revocation and validity of the included credentials, and compliance with specified mandatory fields.
  • Integration with Blockchain: Utilizes blockchain technology for checking the revocation status of credentials through specified smart contract addresses.
  • Support for Multiple Credentials: Capable of handling presentations that include multiple credentials, ensuring each is individually and collectively valid.

Function Signature

TypeScript
async function verifyPresentation(
  vp: VerifiablePresentation,
  options?: VerificationOptions
): Promise<boolean>;

Parameters

  • vp (VerifiablePresentation): The Verifiable Presentation object that needs to be verified. This object includes the presentation’s details such as the holder’s identifier, the Verifiable Credentials included, and the cryptographic proofs that verify the integrity and origin of the presentation.
  • options (VerificationOptions, optional): Configuration options for the verification process. These may include:
    • revocationRegistryAddress (ethers.AddressLike, optional): The address of the smart contract that handles credential revocation.
    • provider (ethers.Provider, optional): The blockchain provider through which blockchain interactions are performed.
    • mandatoryFields (string[], optional): A list of mandatory fields that must be included in the presentation’s proof checking.

Returns

  • Promise<boolean>: A promise that resolves to true if the presentation is verified successfully, or false if the verification fails. Reasons for failure may include invalid or expired proofs, revoked credentials, or failure to meet the specified mandatory fields.

Examples

TypeScript
import { type VerifiablePresentation } from "@terminal3/vc_core";
import { verifyPresentation } from "@terminal3/verify_vp";

const vp = {} as VerifiablePresentation;
const vericationResult = await verifyPresentation(vp);

console.log("Presentation verification: ", vericationResult);