Client Configuration

The Verifier Client library simplifies backend integration by handling communication with the Verifier Service and managing credential validation flows.

Installation

npm install @empe/verifier-client

Configuration Example

Define a configuration object that includes base URLs, secrets, and verification flows:

import { VerifierConfiguration } from '@empe/verifier-client';

const verifierClientConfiguration: VerifierConfiguration = {
  baseUrl: 'https://your-app.example.com',
  verifierServiceUrl: 'https://your-verifier.evdi.app',
  clientSecret: 'your-secure-client-secret',
  verificationFlows: [
    {
      name: 'passwordless-login',
      vpQuery: [],
      handleVerificationResult: (data) => {
        // Return tokens, redirect URLs, or other logic upon verification
        return {
          verification_status: data.verification_status,
          access_token: 'generated-access-token',
          redirect_url: '/dashboard'
        };
      },
      validity: 300
    }
  ]
};

Usage

Integrate the Verifier Client into your server application:

import express from 'express';
import { VerifierClient } from '@empe/verifier-client';

const app = express();
const verifierClient = new VerifierClient(app, verifierClientConfiguration);
verifierClient.initialize();

app.listen(3000, () => console.log('Server running at http://localhost:3000'));

The Verifier Client sets up routes for QR code authorization, SSE connections, and callback handling. Your front-end and wallets then interact with these endpoints seamlessly.

Last updated