@verifner/web
v0.5.0
Published
VerifNer web SDK: guided document and selfie capture for Nigerien identity verification
Maintainers
Readme
@verifner/web
Guided capture for the VerifNer verification API: document front (and back for a CNI), selfie, quality gates in the browser, compression for 3G, upload with a short-lived client token. No framework, no dependencies, one file.
Flow
Your server calls
POST /v1/sessionswith the secret key and gets{ id, client_token }(15 minutes, single use).Your page mounts the SDK with those two values. The secret key never reaches the browser.
The SDK uploads to
POST /v1/sessions/:id/verifyand callsonComplete.Your server trusts the webhook or
GET /v1/sessions/:id, not the browser.
Or npm install @verifner/web, then import { create } from '@verifner/web'.
Screens
Welcome (steps, duration, consent, language) → document (skipped when
documentType is set) → how to prepare it, with tips and an illustration →
camera (the front, then "turn your card over" and the back for a CNI) → a
checklist to review each photo → selfie tips → selfie → sending → result.
Text is set in Satoshi, loaded from verify.verifner.com (font changes it).
By default the person sees "verification sent"; showVerdict: true shows the verdict (verified, in review, not confirmed), never its reasons. Your server decides from the webhook either way.
Quality gates
Each frame under the guide is scored: Laplacian variance (blur), blown-out pixel ratio (glare) and mean luma (dark). Six clean frames in a row (about 1.5 s) trigger auto-capture for documents; the selfie is taken with the button. Captures are cropped to the guide, scaled to 1600 px on the long edge and re-encoded to about 300 KB. Without a camera the file picker takes over, through the same resize.
Develop
npm run build --workspace=@verifner/web # dist/verifner.js, dist/verifner.iife.js, types
node --import tsx --test packages/sdk-web/test/*.test.ts
VERIFNER_API_KEY=vn_test_… node packages/sdk-web/example/server.mjs # http://localhost:3000Face detection
The selfie guide finds the face with a TypeScript port of pico.js and its
facefinder cascade, both by Nenad Markus under the MIT licence
(https://github.com/nenadmarkus/picojs). The cascade (about 240 KB) is served
from verify.verifner.com; set faceModel to host it yourself, or false to
turn the face checks off.
Licence
MIT.
