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

@naniteninja/liveness-verification

v1.10.18

Published

Angular library for liveness verification with pose detection and multi-backend support

Downloads

44

Readme

@naniteninja/liveness-verification

Angular library for liveness verification with pose detection and multi-backend support.

Features

  • 40+ Predefined Poses: Face expressions, head movements, hand gestures, and combined poses
  • Multi-Backend Support: Amazon Rekognition, FaceTec, OpenPose, Azure, and Mock backends
  • Configurable: Extensive configuration options for customization
  • Standalone Components: Works with Angular 14+ standalone components
  • Observable API: RxJS-based API for reactive programming
  • Ionic Integration: Built-in Ionic components for mobile-first UI

Installation

npm install @naniteninja/liveness-verification

Peer Dependencies

npm install @angular/common @angular/core @angular/forms @ionic/angular rxjs

Quick Start

Module-based Usage

import { LivenessVerificationModule } from '@naniteninja/liveness-verification';

@NgModule({
  imports: [
    LivenessVerificationModule.forRoot({
      apiUrl: 'https://api.example.com',
      backends: ['amazon', 'facetec'],
      maxRetries: 3
    })
  ]
})
export class AppModule {}

Standalone Usage

import { provideLivenessVerification } from '@naniteninja/liveness-verification';

bootstrapApplication(AppComponent, {
  providers: [
    provideLivenessVerification({
      apiUrl: 'https://api.example.com',
      backends: ['mock']
    })
  ]
});

Template Usage

<facecog-liveness-verification
  [pose]="5"
  (verificationComplete)="onComplete($event)"
  (verificationError)="onError($event)">
</facecog-liveness-verification>

Library Structure

src/lib/
├── models/
│   ├── types/                              # Type definitions (one per file)
│   │   ├── liveness-backend.type.ts
│   │   ├── verification-flow-step.type.ts
│   │   ├── liveness-action.type.ts
│   │   ├── pose-category.type.ts
│   │   ├── pose-difficulty.type.ts
│   │   ├── detection-strategy.type.ts
│   │   └── index.ts
│   │
│   ├── interfaces/                         # Interface definitions (one per file)
│   │   ├── liveness-verification-config.interface.ts
│   │   ├── verification-step-change-event.interface.ts
│   │   ├── verification-progress-event.interface.ts
│   │   ├── liveness-result.interface.ts
│   │   ├── pose-definition.interface.ts
│   │   ├── ... (14 more interfaces)
│   │   └── index.ts
│   │
│   ├── constants/                          # Constant values
│   │   ├── default-liveness-config.constant.ts
│   │   ├── liveness-verification-config.token.ts
│   │   ├── pose-definitions.constant.ts
│   │   ├── category-info.constant.ts
│   │   └── index.ts
│   │
│   ├── utils/                              # Utility functions
│   │   ├── pose.utils.ts
│   │   └── index.ts
│   │
│   └── index.ts                            # Barrel export
│
├── services/
│   ├── backends/
│   │   ├── backend-adapter.interface.ts
│   │   └── mock-backend.service.ts
│   ├── camera.service.ts
│   ├── liveness-config.service.ts
│   ├── pose-selection.service.ts
│   ├── video-recorder.service.ts
│   └── index.ts
│
├── liveness-verification.component.ts
├── liveness-verification.module.ts
└── public-api.ts

Types

import { 
  LivenessBackend,        // 'amazon' | 'openpose' | 'facetec' | 'azure' | 'mock'
  VerificationFlowStep,   // 'intro' | 'permission' | 'preview' | 'facetec' | 'processing' | 'result'
  LivenessAction,         // 'blink' | 'smile' | 'turn-left' | ... (26 actions)
  PoseCategory,           // 'face' | 'head' | 'hand' | 'gesture' | 'combined'
  PoseDifficulty,         // 'easy' | 'medium' | 'hard'
  DetectionStrategy       // 'face-api' | 'openpose' | 'combined'
} from '@naniteninja/liveness-verification';

Interfaces

import {
  LivenessVerificationConfig,   // Main configuration interface
  LivenessResult,               // Verification result
  PoseDefinition,               // Pose definition
  VerificationStepChangeEvent,  // Step change event
  VerificationProgressEvent,    // Progress event
  BackendResponse,              // Backend response
  // ... and more
} from '@naniteninja/liveness-verification';

Constants

import {
  DEFAULT_LIVENESS_CONFIG,       // Default configuration object
  LIVENESS_VERIFICATION_CONFIG,  // Injection token
  POSE_DEFINITIONS,              // Array of 40 poses
  CATEGORY_INFO                  // Category display info
} from '@naniteninja/liveness-verification';

Utility Functions

import {
  getPoseById,          // Get pose by ID (1-40)
  getPosesByCategory,   // Filter poses by category
  getPosesByDifficulty  // Filter poses by difficulty
} from '@naniteninja/liveness-verification';

Services

PoseSelectionService

import { PoseSelectionService } from '@naniteninja/liveness-verification';

@Component({ ... })
export class MyComponent {
  constructor(private poseSelection: PoseSelectionService) {}

  selectPose(id: number) {
    this.poseSelection.selectPose(id);
  }

  getRandomPose() {
    return this.poseSelection.getRandomPose();
  }
}

LivenessConfigService

import { LivenessConfigService } from '@naniteninja/liveness-verification';

@Component({ ... })
export class MyComponent {
  constructor(private configService: LivenessConfigService) {}

  updateConfig() {
    this.configService.updateConfig({
      maxRetries: 5,
      similarityThreshold: 0.7
    });
  }
}

Configuration Options

| Property | Type | Default | Description | |----------|------|---------|-------------| | apiUrl | string | 'http://localhost:3002' | Backend API URL | | backends | LivenessBackend[] | ['mock'] | Backends to use | | poseId | number | undefined | Predefined pose ID (1-40) | | maxRetries | number | 3 | Maximum retry attempts | | autoCapture | boolean | true | Auto-capture when pose matches | | enableVideoRecording | boolean | true | Record video | | similarityThreshold | number | 0.62 | Pose matching threshold |

Available Poses

Face Expressions (1-6)

Face Straight, Blink Once, Blink Twice, Open Mouth, Smile, Raise Eyebrows

Head Movements (7-14)

Turn Left, Turn Right, Look Up, Look Down, Tilt Left, Tilt Right, Nod, Shake Head

Eye & Face Tracking (15-20)

Follow Dot, Wink, Move Closer, Speak Phrase, Rotate Face, Center Face

Hand Gestures (21-29)

Right Palm, Left Palm, Wave Right, Thumbs Up (R/L), OK Sign, Peace Sign, Three Fingers, Five Fingers

Combined Poses (30-40)

Touch Nose, Touch Chin, Touch Cheek (R/L), Cover Eye, Cover Mouth, Frame Face, Cross Arms, Clap, Point

Events

interface LivenessResult {
  success: boolean;
  confidence: number;
  verifiedImage: string;
  videoBlob?: Blob;
  metadata: LivenessMetadata;
  error?: string;
}

interface VerificationStepChangeEvent {
  step: VerificationFlowStep;
  previousStep?: VerificationFlowStep;
  timestamp: Date;
}

interface VerificationProgressEvent {
  step: VerificationFlowStep;
  progress: number; // 0-100
  message: string;
}

Push Notification Integration

import { PoseSelectionService, LivenessConfigService } from '@naniteninja/liveness-verification';

@Component({ ... })
export class AppComponent {
  showVerification = false;

  constructor(
    private poseSelection: PoseSelectionService,
    private configService: LivenessConfigService
  ) {
    this.pushService.onNotification.subscribe(notification => {
      if (notification.type === 'verification_required') {
        this.poseSelection.selectPose(notification.poseId);
        this.configService.updateConfig({ showIntroScreen: false });
        this.showVerification = true;
      }
    });
  }

  onComplete(result: LivenessResult) {
    this.showVerification = false;
    if (result.success) {
      this.sendToBackend(result);
    }
  }
}

License

MIT