npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

identro-liveness-react

v1.2.0

Published

React SDK for adding Identro biometric liveness verification and face match workflows to web applications.

Readme

Identro Liveness React SDK

React SDK for adding Identro biometric liveness verification and optional face match workflows to React, Vite, and Next.js applications.

The React package now matches the Flutter SDK look and behavior:

  • fullscreen camera experience,
  • automatic liveness start,
  • vertical oval face guide,
  • stepped square corner frame,
  • dark overlay outside the face area,
  • clear center capture area,
  • customizable branding, colors, logo, copy, and powered-by footer,
  • liveness only, BVN match, NIN match, and reference image match,
  • direct Identro API mode,
  • secure backend-proxy mode,
  • optional AWS active liveness mode,
  • passive guided camera mode for Flutter-like UI parity.

Installation

npm install identro-liveness-react

Peer dependencies:

npm install react react-dom

Requirements

  • React 18 or newer.
  • Browser with camera support.
  • HTTPS in production for camera access.
  • Identro merchant API key or a merchant backend proxy.
  • Identro liveness services enabled on your merchant account.

Default Identro API endpoints:

POST /merchant-api/face/liveness/sessions
POST /merchant-api/face/liveness/sessions/:reference/credentials
POST /merchant-api/face/liveness/sessions/:reference/complete

Quick start

import { IdentroLiveness } from 'identro-liveness-react';

export function LivenessPage() {
  return (
    <IdentroLiveness
      baseUrl="https://api.identro.ng/api/v1"
      apiKey="identro_live_xxxxx"
      captureMode="passive"
      request={{
        serviceType: 'FACE_LIVENESS_ONLY',
        sourceType: 'UPLOADED_REFERENCE',
        consentCaptured: true,
        consentReference: 'CUSTOMER-CONSENT-001',
        idempotencyKey: 'LIVE-001',
      }}
      onCompleted={(result) => {
        console.log('Identro result', result);
      }}
      onCancel={() => {
        console.log('User cancelled');
      }}
      onError={(error) => {
        console.error('Identro liveness failed', error);
      }}
    />
  );
}

Capture modes

| Mode | Meaning | Use case | |---|---|---| | passive | Uses the package fullscreen camera UI, captures a compressed selfie frame, and completes the liveness session with fallback evidence | Best visual parity with Flutter SDK and fastest integration | | aws | Creates Identro session, gets temporary AWS credentials, and renders AWS Face Liveness Detector inside the Identro shell | Active challenge-based web liveness |

Default:

captureMode="passive"

Use AWS active liveness:

<IdentroLiveness
  captureMode="aws"
  baseUrl="https://api.identro.ng/api/v1"
  apiKey="identro_live_xxxxx"
  request={request}
/>

Liveness + BVN

<IdentroLiveness
  baseUrl="https://api.identro.ng/api/v1"
  apiKey="identro_live_xxxxx"
  request={{
    serviceType: 'FACE_LIVENESS_BVN',
    sourceType: 'BVN',
    bvn: '22123456789',
    consentCaptured: true,
    consentReference: 'BVN-CONSENT-001',
    idempotencyKey: 'LIVE-BVN-001',
  }}
/>

Liveness + NIN

<IdentroLiveness
  baseUrl="https://api.identro.ng/api/v1"
  apiKey="identro_live_xxxxx"
  request={{
    serviceType: 'FACE_LIVENESS_NIN',
    sourceType: 'NIN',
    nin: '12345678901',
    consentCaptured: true,
    consentReference: 'NIN-CONSENT-001',
    idempotencyKey: 'LIVE-NIN-001',
  }}
/>

Liveness + reference image

<IdentroLiveness
  baseUrl="https://api.identro.ng/api/v1"
  apiKey="identro_live_xxxxx"
  request={{
    serviceType: 'FACE_LIVENESS_REFERENCE',
    sourceType: 'UPLOADED_REFERENCE',
    referenceFaceBase64: 'data:image/jpeg;base64,/9j/4AAQSkZJRg...',
    consentCaptured: true,
    consentReference: 'REFERENCE-CONSENT-001',
    idempotencyKey: 'LIVE-REF-001',
  }}
/>

Full branding customization

<IdentroLiveness
  baseUrl="https://api.identro.ng/api/v1"
  apiKey="identro_live_xxxxx"
  request={request}
  branding={{
    name: 'MyBank',
    subtitle: 'Secure customer verification',
    logo: <img src="/mybank-logo.svg" alt="MyBank" height={32} />,
    poweredByLogoUrl: '/identro-logo.png',

    primaryColor: '#10B981',
    accentColor: '#34D399',
    background: 'linear-gradient(135deg,#020617,#064E3B)',
    textColor: '#ffffff',
    mutedTextColor: 'rgba(255,255,255,.78)',

    fullscreenCamera: true,
    showTopBar: true,
    showActionButtons: false,

    guideDashed: true,
    guideStrokeWidth: 3.5,
    guideGlowOpacity: 0.18,
    guideWidthFactor: 0.54,
    guideHeightFactor: 0.56,

    showCornerFrame: true,
    cornerFrameColor: '#10B981',
    cornerFrameStrokeWidth: 4,
    cornerFrameLength: 36,
    cornerFrameRadius: 18,
    cornerFramePadding: 28,

    overlayOpacity: 0.80,
    centerHighlightOpacity: 0.08,

    showPoweredBy: true,
  }}
/>

Branding options

| Option | Type | Description | |---|---|---| | name | string | Merchant/brand name | | subtitle | string | Brand subtitle | | logoUrl | string | URL logo | | logo | ReactNode | Custom logo node | | poweredByLogoUrl | string | Powered-by logo URL | | poweredByLogo | ReactNode | Custom powered-by logo node | | primaryColor | string | Main brand color | | accentColor | string | Accent color | | background | string | Color or CSS gradient | | fullscreenCamera | boolean | Fullscreen liveness camera | | showTopBar | boolean | Show app-bar/back arrow | | showActionButtons | boolean | Show manual buttons. Default is false because liveness auto-starts | | showPoweredBy | boolean | Show/hide powered-by footer | | guideDashed | boolean | Dashed or solid oval guide | | showCornerFrame | boolean | Show stepped square corner frame | | cornerFrameColor | string | Corner frame color | | overlayOpacity | number | Darkness outside face area | | centerHighlightOpacity | number | Light highlight inside face area |


Text customization

<IdentroLiveness
  baseUrl="https://api.identro.ng/api/v1"
  apiKey="identro_live_xxxxx"
  request={request}
  text={{
    appBarTitle: 'Face verification',
    subtitle: 'Center your face and follow the guide.',
    creatingSession: 'Preparing secure verification...',
    capturing: 'Hold still and keep your face inside the guide',
    processing: 'Finalizing your verification...',
    passed: 'Verification successful',
    review: 'Verification needs review',
    failed: 'Verification failed',
    retry: 'Try again',
    cancel: 'Cancel',
    poweredBy: 'Powered by',
    poweredByBrand: 'Identro',
  }}
/>

Secure backend-proxy mode

For production public apps, do not expose a permanent Identro merchant API key in the browser. Use your backend to call Identro.

<IdentroLiveness
  baseUrl="https://merchant.example.com"
  request={request}
  handlers={{
    async createSession(request) {
      const response = await fetch('/api/identro/liveness/session', {
        method: 'POST',
        headers: { 'content-type': 'application/json' },
        body: JSON.stringify(request),
      });
      if (!response.ok) throw new Error('Unable to create liveness session');
      return response.json();
    },
    async getCredentials(reference, session) {
      const response = await fetch(`/api/identro/liveness/${reference}/credentials`, {
        method: 'POST',
      });
      if (!response.ok) throw new Error('Unable to prepare liveness capture');
      return response.json();
    },
    async completeSession(reference, session, payload) {
      const response = await fetch(`/api/identro/liveness/${reference}/complete`, {
        method: 'POST',
        headers: { 'content-type': 'application/json' },
        body: JSON.stringify(payload),
      });
      if (!response.ok) throw new Error('Unable to complete liveness session');
      return response.json();
    },
  }}
/>

Your backend should call Identro with:

x-api-key: YOUR_PRIVATE_IDENTRO_MERCHANT_API_KEY

Running the example app

cd example
npm install
npm run dev -- --port 8080

Environment variables:

VITE_IDENTRO_BASE_URL=https://api.identro.ng/api/v1
VITE_IDENTRO_API_KEY=your_merchant_api_key
VITE_IDENTRO_MERCHANT_ID=your_merchant_id

Run with env values:

VITE_IDENTRO_BASE_URL=https://api.identro.ng/api/v1 \
VITE_IDENTRO_API_KEY=your_merchant_api_key \
VITE_IDENTRO_MERCHANT_ID=your_merchant_id \
npm run dev -- --port 8080

The example includes:

  • setup screen,
  • merchant ID/API key fields,
  • liveness only/BVN/NIN/reference image choices,
  • passive and AWS capture mode options,
  • branding color controls,
  • fullscreen SDK screen,
  • result screen with scores and raw JSON.

Flutter Web / React Web CORS note

When testing from React on localhost:8080, the backend must allow:

Origin: http://localhost:8080
Headers: Content-Type, Accept, Authorization, x-api-key
Methods: GET, POST, OPTIONS

Troubleshooting

Camera does not open

Use HTTPS in production. Localhost is usually allowed by browsers.

CORS error

Allow your local origin and x-api-key header on the backend.

Request entity too large

Increase backend and Nginx body limits because passive mode submits a compressed camera frame.

Nginx:

client_max_body_size 50M;

NestJS/Express:

app.use(json({ limit: '50mb' }));
app.use(urlencoded({ extended: true, limit: '50mb' }));

Insufficient balance

The merchant wallet balance is lower than the price of the selected liveness service.


Publishing

npm run clean
npm install
npm run typecheck
npm run build
npm pack --dry-run
npm publish --access public

License

MIT. See LICENSE.