Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Code Snippet

This section describes how we use the zkPass SDK in our demo code

Generate Proof

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

...

// Step 1: Instantiate DvrModuleClient
const dvrModuleClient = new DvrModuleClient({
      baseUrl: SERVICE_URL,
      apiKey: API_KEY,
      secretApiKey: API_SECRET,
    });

// Step 2: Call the DVR module client's callDvrGenerateZkPassProof
const zkPassProof = dvrModuleClient.callDvrGenerateZkPassProof(
      JSON.stringify(userDataToken),
      dvrToken
    );

This code snippet generates a zkPass proof. It requires 3 parameters:

  1. SERVICE_URL : you can use https://playground-zkpass.ssi.id , or use your own endpoint if you deploy zkPass on your own server.

  2. API_KEY & API_SECRET: Get yours at https://portal.ssi.id

  3. userDataToken : check Generate User Data Token section for more details.

  4. dvrToken : check Generate DVR Token section for more details.

Verify Proof

This code snippet verifies a zkPass proof token. Components :

  1. zkPassProofToken : check Generate Proof section for more details.

  2. expectedMetadata : this is the expected metadata of the dvr.

  3. dvrPayload: the dvr payload extracted from Dvr token.

Generate User Data Token

This code snippet generate user data token. Components :

  1. signingKey : a private key used to sign user data.

  2. data : user data in JSON format.

Generate DVR Token

This code snippet generate DVR token. Components :

  1. signingKey : a private key used to sign dvr.

  2. dvrData : Dvr data to sign.

Last updated