didPass
didPass Developer's Guide
didPass Developer's Guide
  • getting started
    • 👋Welcome to didPass
    • 📘Introduction
    • 🔺Triangle of Trust
    • ⚡Quickstart
      • Issuer - Typescript/Node.js
      • Verifier - Typescript/Node.js
      • Installing The SDK
  • Issuer
    • 📋Requirements
    • 🔧Installation
    • 💻Sample Code
      • Connecting Wallet with Issuer
        • Request Connect QR Code
        • Authenticate with Signature
      • Download Verifiable Credential
        • Generating QR Code for Claiming VC
        • Claiming and Signing Credential
      • Download Jws Credential
        • Generating QR Code for Claiming JWS Credential
        • Claiming JWS Credential
    • API References
  • Verifier
    • 📃Requirements
    • 🛠️Installation
    • 👨‍💻Sample Code
      • Prerequisite
      • Generating QR Code for DVR
      • Generating Signed DVR Token
      • Verifying Siwe
      • Verifying Proof
    • API References
  • Wallet
    • ✅Requirements
    • 📥Installation
    • 🖥️Sample Code
    • API References
  • References
    • didPass User's Guide
    • zkPass User's Guide
    • zkPass Developer's Guide
Powered by GitBook
On this page
  • Step 1: Import Required Modules
  • Step 2: Set Up Authentication Payload
  • Step 3: Authenticate Signature
  • Step 4: Return Authenticate Result
  • Final Code
  1. Issuer
  2. Sample Code
  3. Connecting Wallet with Issuer

Authenticate with Signature

Step 1: Import Required Modules

Import the necessary modules at the beginning of your script:

import { Auth } from "@didpass/issuer-sdk";

Step 2: Set Up Authentication Payload

Replace the placeholder values with your actual authentication payload:

const connectPayload = {
  sessionId: "YOUR_SESSION_ID",
  did: "USER_DID",
  message: "MESSAGE_FROM_WALLET",
  signature: "SIGNATURE_FROM_WALLET",
};

Step 3: Authenticate Signature

Authenticate the provided signature using the payload:

const auth = new Auth();
const result = await auth.authenticateSignature(
  connectPayload.message,
  connectPayload.signature
);

Step 4: Return Authenticate Result

Return the authentication result:

return result;

Final Code

Here's the complete code:

import { Auth } from "@didpass/issuer-sdk";

async function authenticate() {
  // Set up authentication payload
  const connectPayload = {
    sessionId: "YOUR_SESSION_ID",
    did: "USER_DID",
    message: "MESSAGE_FROM_WALLET",
    signature: "SIGNATURE_FROM_WALLET",
  };

  // Authenticate signature
  const auth = new Auth();
  const result = await auth.authenticateSignature(
    connectPayload.message,
    connectPayload.signature
  );

  // Return authentication result
  return result;
}
PreviousRequest Connect QR CodeNextDownload Verifiable Credential

Last updated 1 year ago

💻