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

facegate-client

v0.1.0

Published

FaceGate client SDK — camera, liveness, face auth. Zero dependencies.

Readme

@facegate/client

Core FaceGate client SDK. Zero framework dependencies. Handles camera access, liveness challenges, face verification, and QR code fallback.

Install

npm install @facegate/client

Quick Start — Supabase App

Most developers should use @facegate/react + @facegate/supabase instead. This package is for non-React apps or custom UI implementations.

import { FaceGateClient, Camera, LivenessOrchestrator } from '@facegate/client'

// 1. Create client
const fg = new FaceGateClient({
  apiKey: 'fg_live_your_api_key_here',
  provider: 'supabase',
})

// 2. Open camera
const camera = new Camera()
await camera.open()

// 3. Run liveness challenge + verification
const orchestrator = new LivenessOrchestrator({
  getChallenge: () => fg.getChallenge(),
  verify: (params) => fg.verify(params),
  captureFrame: () => camera.captureFrame(),
  captureFrames: (count, interval) => camera.captureFrames(count, interval),
  onStateChange: (state) => {
    // Update your UI based on state.phase:
    // 'requesting_challenge' | 'performing' | 'capturing_frames' | 'submitting' | 'passed' | 'failed'
    console.log('Liveness state:', state.phase)
  },
  challengeTimeout: 30_000,
})

const result = await orchestrator.run()

if (result.matched && result.verification_token) {
  // 4. Create Supabase session
  const session = await fg.createSession(result.verification_token)
  console.log('Authenticated:', session.user.name)
  // session.provider_session contains the Supabase access_token + refresh_token
}

// 5. Cleanup
camera.close()

QR Code Fallback (No Camera)

When Camera.isAvailable() returns false, show a QR code instead:

import { FaceGateClient, QRGenerator, HandoffConnection } from '@facegate/client'

const fg = new FaceGateClient({ apiKey: 'fg_live_...', provider: 'supabase' })

// 1. Create handoff session (call your server or FaceGate API)
const handoff = await fg.createHandoffSession()

// 2. Display QR code
const qrDataUrl = await QRGenerator.generateDataUrl(handoff.verify_url)
document.getElementById('qr').src = qrDataUrl

// 3. Listen for phone to complete auth
const conn = new HandoffConnection(handoff.ws_url)
conn.onMessage((msg) => {
  if (msg.type === 'authenticated') {
    console.log('Phone auth complete:', msg.session.user.name)
  }
})
conn.connect()

API Reference

FaceGateClient

| Method | Description | |--------|-------------| | getChallenge() | Get a liveness challenge (blink, turn, nod) | | verify({ image, challengeFrames, nonce }) | Verify face + liveness | | createSession(verificationToken) | Create auth provider session | | enroll({ name, images, role? }) | Enroll a face (admin) | | health() | Check server health |

Camera

| Method | Description | |--------|-------------| | Camera.isAvailable() | Check if camera API exists | | Camera.listDevices() | List video input devices | | camera.open(deviceId?) | Request camera permission + start stream | | camera.captureFrame() | Capture a single JPEG frame | | camera.captureFrames(count, interval) | Capture multiple frames | | camera.close() | Release the camera |

Error Types

| Error | Code | Retryable | |-------|------|-----------| | CameraPermissionDenied | CAMERA_PERMISSION_DENIED | No | | CameraUnavailable | CAMERA_UNAVAILABLE | No | | LivenessTimeout | LIVENESS_TIMEOUT | Yes | | LivenessFailed | LIVENESS_FAILED | Yes | | VerificationFailed | VERIFICATION_FAILED | Yes | | ApiError | API_ERROR | 5xx/429 only | | NetworkError | NETWORK_ERROR | Yes | | InvalidApiKey | INVALID_API_KEY | No |