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

liveface

v1.2.0

Published

React Native (Expo) SDK for LivFace — drop-in biometric liveness detection and ID document verification using challenge-response camera analysis.

Readme

liveface

React Native (Expo) SDK for LivFace — challenge-response biometric liveness detection and ID document verification.

  • Detects real humans vs photos, video replays, and deepfakes
  • 7 randomised challenge types per session (Blink, Smile, Turn Left/Right, Open Mouth, Look Down, Raise Eyebrows)
  • Optional ID document matching — compare a live face against a passport/ID photo
  • Drop-in <LivenessView> component or low-level useLiveness hook for custom UIs
  • Handles camera permissions, frame capture, progress display, and result overlay automatically

Requirements

  • Expo SDK 50+
  • expo-camera ≥ 14
  • React Native ≥ 0.73
  • A LivFace API account and API key → livface.com

Installation

npx expo install expo-camera
npm install liveface

Add camera permission to your app.json:

{
  "expo": {
    "plugins": [
      ["expo-camera", { "cameraPermission": "Allow $(PRODUCT_NAME) to verify your identity." }]
    ]
  }
}

Quick start

1. Create a session from your backend

Never call this from the client — your API key must stay on the server.

// Your backend (Node.js, Python, etc.)
const res = await fetch('https://api.yourdomain.com/v1/sessions', {
  method: 'POST',
  headers: {
    'x-api-key': process.env.LIVEFACE_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ challenge_count: 5 }),
})
const { session_id } = await res.json()
// Pass session_id to your mobile app

2. Drop in <LivenessView>

import { LivenessView } from 'liveface'

export function VerifyScreen({ route, navigation }) {
  const { sessionId } = route.params

  return (
    <LivenessView
      apiUrl="https://api.yourdomain.com"
      sessionId={sessionId}
      onComplete={(result) => {
        if (result.passed) {
          navigation.replace('Success', { score: result.score })
        } else {
          navigation.replace('Failed', { reason: result.reason })
        }
      }}
    />
  )
}

That's it. The component handles everything: permission requests, camera preview, challenge instructions, progress dots, and the pass/fail overlay.


ID document verification

Pass a base64 JPEG of the ID/passport photo as idImageB64. LivFace will extract the face from the document and compare it against the live capture on the final frame.

<LivenessView
  apiUrl="https://api.yourdomain.com"
  sessionId={sessionId}
  idImageB64={idPhotoBase64}   // base64 JPEG, no data-URI prefix
  onComplete={(result) => {
    console.log(result.passed)        // overall result
    console.log(result.idVerified)    // ID face matched live face
    console.log(result.idMatchScore)  // 0.0 – 1.0 similarity score
    console.log(result.livenessVerified) // passed all challenges
  }}
/>

Custom UI with useLiveness

Use the hook directly when you need full control over the camera view or UI layout.

import { useRef } from 'react'
import { CameraView } from 'expo-camera'
import { useLiveness } from 'liveface'

export function CustomVerifyScreen({ sessionId }) {
  const { cameraRef, phase, status, progressCount, progressTotal, start, reset } =
    useLiveness({
      apiUrl: 'https://api.yourdomain.com',
      sessionId,
      frameIntervalMs: 800,
      onComplete: (result) => console.log(result),
      onError: (err) => console.error(err),
    })

  return (
    <>
      <CameraView ref={cameraRef} facing="front" style={{ flex: 1 }} />
      <Text>{status}</Text>
      <Text>{progressCount} / {progressTotal}</Text>
      {phase === 'idle' && <Button title="Start" onPress={start} />}
      {phase === 'failed' && <Button title="Retry" onPress={reset} />}
    </>
  )
}

Low-level client

For fully custom camera implementations (non-Expo, custom frame capture, etc.):

import { LivenessClient } from 'liveface'

const client = new LivenessClient('https://api.yourdomain.com')

// Optional: upload ID photo first
await client.uploadId(sessionId, idImageBase64)

// Drive the session with a frame-capture callback
const result = await client.run(
  async () => {
    const photo = await camera.takePictureAsync({ base64: true, quality: 0.6 })
    return photo.base64
  },
  {
    sessionId,
    frameIntervalMs: 1000,
    onStatus:   (msg) => console.log(msg),
    onProgress: (done, total, challenge) => console.log(done, '/', total, challenge),
  },
)

console.log(result.passed, result.score, result.idMatchScore)

LivenessResult

interface LivenessResult {
  passed: boolean           // overall pass/fail
  sessionId: string
  score?: number            // liveness confidence 0.0 – 1.0
  livenessVerified?: boolean
  idVerified?: boolean      // ID face matched (only if idImageB64 was provided)
  idMatchScore?: number     // face similarity 0.0 – 1.0
  reason?: string           // failure reason: 'spoof_detected' | 'session_expired' | etc.
}

License

MIT