@richard.fadiora/liveness-detection 4.2.14 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,138 +1 @@
1
- import { AfterViewInit } from '@angular/core';
2
- import { default as default_2 } from 'react-webcam';
3
- import { ElementRef } from '@angular/core';
4
- import { EventEmitter } from '@angular/core';
5
- import { NgZone } from '@angular/core';
6
- import { Observable } from 'rxjs';
7
- import { OnDestroy } from '@angular/core';
8
- import { OnInit } from '@angular/core';
9
-
10
- export declare type Challenge = "Smile" | "Blink" | "Turn_Head" | "Thumbs_Up";
11
-
12
- export declare class LivenessComponent implements OnInit, AfterViewInit, OnDestroy {
13
- liveness: LivenessService;
14
- webcamRef: ElementRef<HTMLVideoElement>;
15
- apiUrl: string;
16
- duration: number;
17
- smileThreshold?: number;
18
- blinkThreshold?: number;
19
- minturnHeadThreshold?: number;
20
- maxturnHeadThreshold?: number;
21
- containerClass: string;
22
- videoWrapperClass: string;
23
- videoClass: string;
24
- timerClass: string;
25
- challengeTextClass: string;
26
- buttonClass: string;
27
- retryButtonClass: string;
28
- statusOverlayClass: string;
29
- successMessageClass: string;
30
- errorMessageClass: string;
31
- instructionBoxClass: string;
32
- onComplete: EventEmitter<LivenessSDKResult>;
33
- onError: EventEmitter<any>;
34
- constructor(liveness: LivenessService);
35
- ngOnInit(): void;
36
- ngAfterViewInit(): Promise<void>;
37
- ngOnDestroy(): void;
38
- }
39
-
40
- export declare class LivenessEngine {
41
- private config;
42
- private models;
43
- private webcam;
44
- private state;
45
- private currentStepRef;
46
- private isStepTransitioningRef;
47
- private timerId;
48
- private requestId;
49
- private offscreenCanvas;
50
- private CHALLENGE_POOL;
51
- constructor(config: LivenessEngineConfig);
52
- /**
53
- * Phase 1: Load AI Assets (Call this immediately on mount)
54
- */
55
- loadModels(): Promise<void>;
56
- /**
57
- * Phase 2: Attach Video (Call this once the Webcam is in the DOM)
58
- */
59
- attachVideo: (video: HTMLVideoElement) => void;
60
- start: () => void;
61
- stop: () => void;
62
- reset: () => void;
63
- private updateState;
64
- private generateSequence;
65
- private startTimer;
66
- private detectLoop;
67
- private handleStepSuccess;
68
- private checkAction;
69
- private sendFinalProof;
70
- private getFaceCrop;
71
- }
72
-
73
- export declare interface LivenessEngineConfig {
74
- apiUrl: string;
75
- duration?: number;
76
- smileThreshold?: number;
77
- blinkThreshold?: number;
78
- minturnHeadThreshold?: number;
79
- maxturnHeadThreshold?: number;
80
- onStateChange?: (state: LivenessState) => void;
81
- onComplete?: (result: LivenessSDKResult) => void;
82
- onError?: (error: LivenessSDKResult) => void;
83
- }
84
-
85
- export declare interface LivenessResponse {
86
- is_live: boolean;
87
- reason?: string;
88
- skin_confidence?: number;
89
- [key: string]: any;
90
- }
91
-
92
- export declare interface LivenessSDKResult {
93
- success: boolean;
94
- image?: string;
95
- reason?: string;
96
- skinConfidence?: number;
97
- }
98
-
99
- export declare class LivenessService implements OnDestroy {
100
- private ngZone;
101
- private engine;
102
- private stateSubject;
103
- state$: Observable<LivenessState | null>;
104
- constructor(ngZone: NgZone);
105
- init(config: LivenessEngineConfig): void;
106
- attach(video: HTMLVideoElement): void;
107
- start(): void;
108
- reset(): void;
109
- ngOnDestroy(): void;
110
- }
111
-
112
- export declare interface LivenessState {
113
- status: "loading" | "ready" | "capturing" | "verifying" | "success" | "error" | "expired";
114
- sequence: Challenge[];
115
- currentStep: number;
116
- timeLeft: number;
117
- isStepTransitioning: boolean;
118
- errorMsg: string;
119
- }
120
-
121
- export declare const useLiveness: (config: LivenessEngineConfig) => UseLivenessHook;
122
-
123
- export declare interface UseLivenessHook extends LivenessState {
124
- webcamRef: React.RefObject<default_2>;
125
- start: () => void;
126
- reset: () => void;
127
- }
128
-
129
- /**
130
- * Sends captured frames to the backend API for liveness verification.
131
- * @param apiUrl - Base URL of the liveness backend
132
- * @param frameBlobs - Array of Blob objects representing captured frames
133
- * @param challenge - The current challenge string
134
- * @returns LivenessResponse from backend
135
- */
136
- export declare const verifyLiveness: (apiUrl: string, frameBlobs: Blob[], challenge: Challenge[]) => Promise<LivenessResponse>;
137
-
138
- export { }
1
+ export * from './index'