Verifier - Typescript/Node.js
Verifier Demo Application
This application is built with Node.js/Typescript to demonstrate the usage of the verifier-sdk 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 here.
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
Windows Subsystem for Linux (WSL) (Optional, if you run this application on windows)
Docker (Optional, if you run this application on windows or mac)
ngrok is needed as the wallet needs to communicate with the verifier application on your local
Installation
To ensure a smooth experience with the demo, we recommend running it within a WSL (Windows Subsystem for Linux) environment or Docker container. If you are not able to use WSL to run the demo, follow Running in Docker Container.
Clone the demo project from Github
git clone https://github.com/GDP-ADMIN/didPass-demo.gitOpen the verifier-demo directory
Install dependencies
Rename
.env.exampleto.envInitiate ngrok by following these step
Change the
NEXT_PUBLIC_URLon.envto the ngrok forwarding url forlocalhost:3002on step 4Run verifier demo
Finally, access the verifier demo on http://localhost:3002
Setting up ngrok
Initiate new terminal on
didpass-demo/verifier-demorepositoryRun 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:
Make sure the Docker engine is installed and running
Run
docker composethrough the pre-defined npm command, and wait until it finishes
Once it is done, the container should automatically be started and exposed to port
3002Finally, access the verifier demo on https://localhost:3002
Testing the Verifier Demo
Click on the
Start DemobuttonRead through the
Introductionsections until you reach theStart Verificationpage.Click on the
Retrieve QR Codebutton and wait until the QR code is generatedScan the QR code using the wallet
In the wallet, press
confirm and continueto start generating proofEvery few seconds, the demo will automatically check the status of the verification process
If the verification process is completed (until proof verification), you will be redirected to the
results page
If you encounter any error while testing Verifier Demo, please refresh the page and start the demo from the beginning
Modifying the Verifier Demo
Adding more use cases
You can add or modify use cases here
To add a new use case, you need to add to the following places:
Verify Cases - name of verification use case
Verify Credential Type - assign which credentials to be verified
DVR Title - the DVR title for verification use cases
Verify Case Map - details of verification use cases (field, operator, and expected value)
Modify proof validator
Modify the proof metadata validator as you need, you can find it here
Code Snippets
Generate QR Code
Import the necessary classes from the SDK
Initialize Verifier instance to generate the QR code
Prepare the data for the QR code generation
Generate QR code using the
verifier-sdk
Here's the full code:
Create Signed DVR
Import the necessary classes from the SDK
Initialize Verifier and ZkPassClient instance to sign DVR
Verify SIWE message and signature using SDK
Retrieve private key to sign data, url containing jwks and kid from environment variables
Prepare DVR to sign
Sign DVR through the
verifier-sdk
Here's the full code:
Verify Proof
Import the necessary classes from the SDK
Initialize Verifier instance to verify the proof
Prepare metdata validator for proof verification
Verify the proof using the
verifier-sdk
Here's the full code:
Last updated