2. Providing Proof Verification API

Providing a REST API to verify ZkPass Proof

Dvr Module Client Integration

In the proof verification API implementation, the Proof Verifier needs to verify the received ZkPass as shown here.

import { DvrModuleClient, extractPayload } from "@zkpass/dvr-client-ts";

const dvrPayload = extractPayload(dvrToken);
...

// Step 1: Instantiate the zkPassClient object.
const dvrModuleClient = new DvrModuleClient({
      baseUrl: ZKPASS_SERVICE_URL,
      apiKey: API_KEY,
      secretApiKey: API_SECRET,
    });

// Step 2: Create the expected metadata
const expectedMetadata = {
      dvr: JSON.stringify(dvrPayload),
      ttl: EXPECTED_DVR_TTL,
      user_data_verifying_keys: userDataVerifyingKeys,
    };

// Step 3: Call zkPassClient.verifyZkPassProof to verify the proof.
const proofOutput = dvrModuleClient.callDvrVerifyZkPassProof(
      ZKPASS_ZKVM,
      zkPassProofToken,
      expectedMetadata
    );

Last updated