Verifier - Typescript/Node.js

Verifier Demo Application

This application is built with Node.js/Typescript to demonstrate the usage of the verifier-sdkarrow-up-right package. Please note that you will also need to have the latest didPass-Wallet application on your phone to test the demo application. you can download the latest apk herearrow-up-right.

Also, to perform verification, you will need to already have credentials in your wallet. So, to use this demo, you must first claim credentials through the Issuer Demo.

Prerequisites

  1. Windows Subsystem for Linux (WSL)arrow-up-right (Optional, if you run this application on windows)

  2. Dockerarrow-up-right (Optional, if you run this application on windows or mac)

circle-info

ngrok is needed as the wallet needs to communicate with the verifier application on your local

Installation

circle-exclamation
  1. Clone the demo project from Githubarrow-up-right

git clone https://github.com/GDP-ADMIN/didPass-demo.git
  1. Open the verifier-demo directory

  1. Install dependencies

  1. Rename .env.example to .env

  2. Initiate ngrok by following these step

  3. Change the NEXT_PUBLIC_URL on .env to the ngrok forwarding url for localhost:3002 on step 4

  4. Run verifier demo

  1. Finally, access the verifier demo on http://localhost:3002arrow-up-right

Setting up ngrok

  1. Initiate new terminal on didpass-demo/verifier-demo repository

  2. Run the following command on terminal

Running in Docker Container

In the event, you are not able to run the demo through npm run dev, we also provide an easy way to start the application inside a Docker container. To do this, follow the following guide:

  1. Make sure the Docker engine is installed and running

  2. Run docker compose through the pre-defined npm command, and wait until it finishes

  1. Once it is done, the container should automatically be started and exposed to port 3002

  2. Finally, access the verifier demo on https://localhost:3002arrow-up-right

Testing the Verifier Demo

  1. Click on the Start Demo button

  2. Read through the Introduction sections until you reach the Start Verification page.

  3. Click on the Retrieve QR Code button and wait until the QR code is generated

  4. Scan the QR code using the wallet

  5. In the wallet, press confirm and continue to start generating proof

  6. Every few seconds, the demo will automatically check the status of the verification process

  7. If the verification process is completed (until proof verification), you will be redirected to the results page

circle-exclamation

Modifying the Verifier Demo

  1. Adding more use cases

  2. Modify proof validator

Code Snippets

Generate QR Code

  1. Import the necessary classes from the SDK

  1. Initialize Verifier instance to generate the QR code

  1. Prepare the data for the QR code generation

  1. Generate QR code using the verifier-sdk

Here's the full code:

Create Signed DVR

  1. Import the necessary classes from the SDK

  1. Initialize Verifier and ZkPassClient instance to sign DVR

  1. Verify SIWE message and signature using SDK

  1. Retrieve private key to sign data, url containing jwks and kid from environment variables

  1. Prepare DVR to sign

  1. Sign DVR through the verifier-sdk

Here's the full code:

Verify Proof

  1. Import the necessary classes from the SDK

  1. Initialize Verifier instance to verify the proof

  1. Prepare metdata validator for proof verification

  1. Verify the proof using the verifier-sdk

Here's the full code:

Last updated