Skip to main content

Install & configure

The JavaScript SDK ships as @drukverify/ekyc-sdk-js — a universal (browser + Node.js) client with zero runtime dependencies (~3.2 KB gzipped core, ~2.9 KB optional camera components). It is published to the public npm registry.

Install

npm add @drukverify/ekyc-sdk-js
# or
pnpm add @drukverify/ekyc-sdk-js
# or
yarn add @drukverify/ekyc-sdk-js

Offline / mirrored installs

For air-gapped builds or an internal artifact repository (Artifactory/Nexus), pull the checksummed tarball from the GitHub release, verify it, and install locally:

shasum -a 256 -c SHA256SUMS
npm install ./drukverify-ekyc-sdk-js-0.3.2.tgz

Configure a client

import { EkycClient } from "@drukverify/ekyc-sdk-js";

const client = new EkycClient({
baseUrl: "https://api.drukverify.com", // required, no trailing slash
apiKey: credential, // see below
version: "2026-05-12", // Drukverify-Version header (default shown)
timeout: 90_000, // required for chained fraud plus OCR
});

Use at least 90 seconds when calling the synchronous fraud route. It runs OCR before fraud analysis, and real-document OCR can take up to 60 seconds.

Authentication: browser vs server

  • Server-side (Node): use your secret key (dv_sk_…) directly as apiKey.
  • Browser: never embed a secret key. Your backend exchanges the secret key for a short-lived session token via POST /v1/sessions and hands the resulting dv_tok_… to the page:
const { token } = await fetch("/your-backend/session").then((r) => r.json());
const client = new EkycClient({
baseUrl: "https://api.drukverify.com",
apiKey: token,
});

The SDK stores nothing in the browser — no cookies, no localStorage; the token lives in JS memory only.

Supported environments

Node.js 18+ and the last two major versions of Chrome, Edge, Firefox, and Safari (15+). Camera capture requires a secure context (HTTPS).