Issuer - Typescript/Node.js

Issuer Demo Application

This application built with Node.js/Typescript to demonstrate the usage of issuer-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 herearrow-up-right.

Prerequisites

circle-info

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

Run Issuer Demo Application

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

git clone https://github.com/GDP-ADMIN/didPass-demo.git
  1. Navigate to the issuer-demo

cd didPass-demo/didpass-demo/issuer-demo
  1. Install all dependencies with npm

npm install
  1. Rename .env.example to .env

  2. Initiate ngrok by following these step

  3. Change NEXT_PUBLIC_URL and NEXT_PUBLIC_DOMAIN_URL on .env to the forwarding port from ngrok that has been initiated on step 5, for example my ngrok forwarding url is https://9c53-149-108-164-96.ngrok-free.app

  1. Run the application

  1. Access the demo on localhost:3000arrow-up-right

Setting up ngrok

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

  2. Run the following command on terminal

Testing the Demo Application

  1. Access localhost:3000arrow-up-right on your browser

  2. Click Connect button to show the QR Code

  1. Scan the QR Code from didPass-Wallet application on your phone and wait for the process to finish

  2. The data shown on your verifier-demo is the mock data that will be claimed by your wallet

  3. To claim the data, click Claim by VC or Claim by JWT button on the bottom of the screen (for now, to test with the verifier you will need to claim the credential by JWT)

  1. QR Code will be shown, scan it to claim the data and wait for the process to complete

  2. Check if the data successfully claimed on wallet's List of Credentials page

circle-exclamation

Modifying the Demo Application Data

You can modify the mock data by changing the values on didPass-demo/didpass-demo/issuer-demo/src/backend/mocks/detailCredentialMock.json

Code Snippets

Before delving into the code snippets, it's important to note that the following examples utilize mocked data to simulate user information. Below is the mocked data in JSON format:

Generate Connect QR Code

  1. Import the necessary classes from the SDK

  1. Initialize DIDAccount instance for the QRGenerator to use

  1. Prepare the data for QR Code generation

  1. Generate QR Code

Here's the full code

Authenticate Signature

  1. Import the necessary classes from the SDK

  1. Initialize Auth instance

  1. Prepare the data for Authentication from the payload

  1. Authenticate

Here's the full code

Generate Credential QR Code

  1. Import the necessary classes from the SDK

  1. Initialize DIDAccount instance for the QRGenerator to use

  1. Prepare the data for QR Code generation

  1. Generate QR Code

Here's the full code

Sign Credential (For Verifiable Credential)

  1. Import the necessary classes from the SDK

  1. Initialize the DIDAccount

  1. Prepare the data to be signed

  1. Sign Credential

Here's the full code

Tokenize Credentials (For JWT)

  1. Import the necessary classes from the SDK

  1. Initialize the DID Account

  1. Prepare the data to be tokenized

  1. Initialize the JWS Credential and tokenize the credential

Here's the full code

Last updated