@moveris/shared 2.7.0 → 3.0.0
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/README.md +169 -20
- package/dist/index.d.mts +52 -6
- package/dist/index.d.ts +52 -6
- package/dist/index.js +215 -59
- package/dist/index.mjs +211 -59
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,13 +47,14 @@ The main client for interacting with the Moveris Liveness API.
|
|
|
47
47
|
const client = new LivenessClient(config: LivenessClientConfig);
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
| Option
|
|
51
|
-
|
|
|
52
|
-
| `apiKey`
|
|
53
|
-
| `baseUrl`
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
50
|
+
| Option | Type | Default | Description |
|
|
51
|
+
| -------------- | -------------- | --------------------------- | ------------------------------------------------------------------ |
|
|
52
|
+
| `apiKey` | `string` | **required** | Your Moveris API key |
|
|
53
|
+
| `baseUrl` | `string` | `'https://api.moveris.com'` | API base URL |
|
|
54
|
+
| `modelVersion` | `ModelVersion` | - | Model version alias for `X-Model-Version` header (e.g. `'latest'`) |
|
|
55
|
+
| `timeout` | `number` | `30000` | Request timeout in milliseconds |
|
|
56
|
+
| `enableRetry` | `boolean` | `true` | Enable automatic retry with exponential backoff |
|
|
57
|
+
| `customFetch` | `typeof fetch` | `fetch` | Custom fetch implementation (for React Native) |
|
|
57
58
|
|
|
58
59
|
#### Methods
|
|
59
60
|
|
|
@@ -71,11 +72,13 @@ const result = await client.fastCheck(frames, {
|
|
|
71
72
|
|
|
72
73
|
**Parameters:**
|
|
73
74
|
|
|
74
|
-
| Option
|
|
75
|
-
|
|
|
76
|
-
| `sessionId`
|
|
77
|
-
| `model`
|
|
78
|
-
| `
|
|
75
|
+
| Option | Type | Default | Description |
|
|
76
|
+
| -------------- | ---------------- | --------------- | ----------------------------------------------------------------- |
|
|
77
|
+
| `sessionId` | `string` | auto-generated | Unique session identifier (UUID) |
|
|
78
|
+
| `model` | `FastCheckModel` | `'mixed-10-v2'` | Model to use (see Models section) |
|
|
79
|
+
| `modelVersion` | `ModelVersion` | - | Version alias sent via `X-Model-Version` header (e.g. `'latest'`) |
|
|
80
|
+
| `frameCount` | `number` | - | Frame count for alias-based model resolution |
|
|
81
|
+
| `source` | `FrameSource` | `'live'` | Frame source: `'live'` (camera) or `'media'` (recorded video) |
|
|
79
82
|
|
|
80
83
|
**Returns:** `Promise<LivenessResult>`
|
|
81
84
|
|
|
@@ -94,6 +97,7 @@ const crops: CropData[] = capturedFrames.map((f) => ({
|
|
|
94
97
|
const result = await client.fastCheckCrops(crops, {
|
|
95
98
|
model: '10',
|
|
96
99
|
source: 'live',
|
|
100
|
+
bgSegmentation: true, // optional — sent as bg_segmentation in payload
|
|
97
101
|
});
|
|
98
102
|
```
|
|
99
103
|
|
|
@@ -207,11 +211,36 @@ Active models (recommended):
|
|
|
207
211
|
|
|
208
212
|
Legacy models (still supported):
|
|
209
213
|
|
|
210
|
-
| Value | Frames | Description
|
|
211
|
-
| ------- | ------ |
|
|
212
|
-
| `'10'` | 10 | Standard — fast
|
|
213
|
-
| `'50'` | 50 | Standard — balanced |
|
|
214
|
-
| `'250'` | 250 | Standard — highest accuracy |
|
|
214
|
+
| Value | Frames | Description |
|
|
215
|
+
| ------- | ------ | ------------------------------------------------ |
|
|
216
|
+
| `'10'` | 10 | Standard — fast (alias: `'fast'`) |
|
|
217
|
+
| `'50'` | 50 | Standard — balanced (alias: `'spatial'`) |
|
|
218
|
+
| `'250'` | 250 | Standard — highest accuracy (alias: `'spatial'`) |
|
|
219
|
+
|
|
220
|
+
Hybrid-v2 models (alias: `'hybrid'`):
|
|
221
|
+
|
|
222
|
+
| Value | Frames | Description |
|
|
223
|
+
| ----------------- | ------ | ---------------------------- |
|
|
224
|
+
| `'hybrid-v2-10'` | 10 | Hybrid v2 — fast |
|
|
225
|
+
| `'hybrid-v2-30'` | 30 | Hybrid v2 — balanced |
|
|
226
|
+
| `'hybrid-v2-60'` | 60 | Hybrid v2 — higher accuracy |
|
|
227
|
+
| `'hybrid-v2-90'` | 90 | Hybrid v2 — high accuracy |
|
|
228
|
+
| `'hybrid-v2-100'` | 100 | Hybrid v2 — high accuracy |
|
|
229
|
+
| `'hybrid-v2-120'` | 120 | Hybrid v2 — highest accuracy |
|
|
230
|
+
| `'hybrid-v2-125'` | 125 | Hybrid v2 — highest accuracy |
|
|
231
|
+
| `'hybrid-v2-250'` | 250 | Hybrid v2 — maximum accuracy |
|
|
232
|
+
|
|
233
|
+
Deprecated models (v1 — sunset 2026-09-01):
|
|
234
|
+
|
|
235
|
+
| Value | Frames | Replacement |
|
|
236
|
+
| ------------- | ------ | ---------------- |
|
|
237
|
+
| `'mixed-10'` | 10 | `'mixed-10-v2'` |
|
|
238
|
+
| `'mixed-30'` | 30 | `'mixed-30-v2'` |
|
|
239
|
+
| `'mixed-60'` | 60 | `'mixed-60-v2'` |
|
|
240
|
+
| `'mixed-90'` | 90 | `'mixed-90-v2'` |
|
|
241
|
+
| `'mixed-120'` | 120 | `'mixed-120-v2'` |
|
|
242
|
+
| `'mixed-150'` | 150 | — |
|
|
243
|
+
| `'mixed-250'` | 250 | — |
|
|
215
244
|
|
|
216
245
|
#### FrameSource
|
|
217
246
|
|
|
@@ -265,6 +294,7 @@ interface LivenessResult {
|
|
|
265
294
|
sessionId: string; // Session identifier
|
|
266
295
|
processingMs: number; // Server processing time
|
|
267
296
|
framesProcessed: number; // Number of frames analyzed
|
|
297
|
+
deprecation?: DeprecationInfo; // Present when X-Moveris-Model-Resolved header is returned
|
|
268
298
|
}
|
|
269
299
|
```
|
|
270
300
|
|
|
@@ -291,6 +321,80 @@ interface CropData {
|
|
|
291
321
|
}
|
|
292
322
|
```
|
|
293
323
|
|
|
324
|
+
#### ModelVersion
|
|
325
|
+
|
|
326
|
+
Version alias sent via the `X-Model-Version` request header for server-side model resolution.
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
type ModelVersion = 'latest' | 'v2' | 'v1' | 'fast' | 'spatial' | 'hybrid' | (string & object);
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
| Value | Resolves to |
|
|
333
|
+
| ----------- | ----------------------------------- |
|
|
334
|
+
| `'latest'` | Current production mixed-v2 model |
|
|
335
|
+
| `'v2'` | Pinned mixed-v2 version |
|
|
336
|
+
| `'v1'` | Legacy mixed-v1 models (deprecated) |
|
|
337
|
+
| `'fast'` | Model `'10'` |
|
|
338
|
+
| `'spatial'` | Models `'50'` / `'250'` |
|
|
339
|
+
| `'hybrid'` | Hybrid-v2 models |
|
|
340
|
+
|
|
341
|
+
> When `X-Model-Version` is set, the API also requires `frame_count` in the request body. Pass it via the `frameCount` option.
|
|
342
|
+
|
|
343
|
+
#### DeprecationInfo
|
|
344
|
+
|
|
345
|
+
Parsed from API response headers when the server resolves a model.
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
interface DeprecationInfo {
|
|
349
|
+
deprecated: boolean; // true when model is deprecated
|
|
350
|
+
resolvedModel: string; // Concrete model id (X-Moveris-Model-Resolved)
|
|
351
|
+
deprecatedModel?: string; // Deprecated model id (X-Moveris-Deprecated-Model)
|
|
352
|
+
sunsetDate?: string; // ISO date of removal (Sunset header)
|
|
353
|
+
suggestedModel?: string; // Replacement model (X-Moveris-Suggested-Model)
|
|
354
|
+
}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
### Model Versioning & Deprecation
|
|
360
|
+
|
|
361
|
+
The client supports model alias resolution via the `X-Model-Version` header and automatically parses deprecation headers from API responses.
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
// Use aliases for automatic server-side resolution
|
|
365
|
+
const client = new LivenessClient({
|
|
366
|
+
apiKey: 'mv_your_api_key',
|
|
367
|
+
modelVersion: 'latest', // sent as X-Model-Version header on every request
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
const result = await client.fastCheck(frames, {
|
|
371
|
+
model: 'mixed-30-v2',
|
|
372
|
+
frameCount: 30, // required when modelVersion is set
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
// Deprecation info is automatically parsed from response headers
|
|
376
|
+
if (result.deprecation?.deprecated) {
|
|
377
|
+
console.warn(`Model "${result.deprecation.resolvedModel}" is deprecated.`);
|
|
378
|
+
console.warn(`Migrate to "${result.deprecation.suggestedModel}".`);
|
|
379
|
+
console.warn(`Sunset date: ${result.deprecation.sunsetDate}`);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Per-call override (takes precedence over client-level modelVersion)
|
|
383
|
+
const result2 = await client.fastCheck(frames, {
|
|
384
|
+
modelVersion: 'v2',
|
|
385
|
+
frameCount: 10,
|
|
386
|
+
});
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
#### Valid Frame Counts
|
|
390
|
+
|
|
391
|
+
When using model version aliases, `frameCount` must be one of:
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
import { VALID_FRAME_COUNTS } from '@moveris/shared';
|
|
395
|
+
// [10, 30, 60, 90, 120]
|
|
396
|
+
```
|
|
397
|
+
|
|
294
398
|
---
|
|
295
399
|
|
|
296
400
|
### Utilities
|
|
@@ -443,6 +547,9 @@ const status = getStatusMessage('capturing', DEFAULT_LOCALE);
|
|
|
443
547
|
| `eyes_overexposed` | "Eye region overexposed…" | Eye region too bright |
|
|
444
548
|
| `glasses_glare` | "Glare detected…" | Specular highlights on eyes |
|
|
445
549
|
| `eye_quality_poor` | "Eye region quality is poor" | Generic eye quality failure |
|
|
550
|
+
| `camera_angle_low` | "Raise camera to eye level" | Camera below face (Y < 0.3) |
|
|
551
|
+
| `camera_angle_high` | "Lower camera to eye level" | Camera above face (Y > 0.7) |
|
|
552
|
+
| `camera_tilted` | "Hold camera level" | Eye line deviates > 15° |
|
|
446
553
|
|
|
447
554
|
---
|
|
448
555
|
|
|
@@ -529,7 +636,13 @@ if (bounds) {
|
|
|
529
636
|
Utilities for assessing frame quality before submission.
|
|
530
637
|
|
|
531
638
|
```typescript
|
|
532
|
-
import {
|
|
639
|
+
import {
|
|
640
|
+
isFaceFullyVisible,
|
|
641
|
+
isFaceInOval,
|
|
642
|
+
calculateFaceCropRegion,
|
|
643
|
+
detectFaceRoll,
|
|
644
|
+
detectCameraAngle,
|
|
645
|
+
} from '@moveris/shared';
|
|
533
646
|
|
|
534
647
|
// Check if face is fully visible in frame
|
|
535
648
|
const visibility = isFaceFullyVisible(faceBbox, frameWidth, frameHeight);
|
|
@@ -547,8 +660,17 @@ const cropRegion = calculateFaceCropRegion(faceBbox, frameWidth, frameHeight);
|
|
|
547
660
|
|
|
548
661
|
// Calculate adaptive crop multiplier based on face size
|
|
549
662
|
import { calculateAdaptiveCropMultiplier } from '@moveris/shared';
|
|
550
|
-
const multiplier = calculateAdaptiveCropMultiplier(
|
|
551
|
-
// Returns
|
|
663
|
+
const multiplier = calculateAdaptiveCropMultiplier(faceBox, frameWidth, frameHeight);
|
|
664
|
+
// Returns 2.5–4.0x (matched to cognito-check for ~33% face coverage in 224×224 crop)
|
|
665
|
+
|
|
666
|
+
// Detect face roll (device tilt) from eye-corner landmarks
|
|
667
|
+
const rollResult = detectFaceRoll(landmarks); // requires ≥364 landmarks
|
|
668
|
+
// { roll: number (degrees), tooTilted: boolean }
|
|
669
|
+
|
|
670
|
+
// Detect camera vertical angle from forehead/nose/chin landmark ratio
|
|
671
|
+
const angleResult = detectCameraAngle(landmarks); // requires ≥153 landmarks
|
|
672
|
+
// { ratio: number, cameraAbove: boolean, cameraBelow: boolean }
|
|
673
|
+
// ratio ~1.0 at eye level; >1.35 = camera above user; <0.75 = camera below user
|
|
552
674
|
```
|
|
553
675
|
|
|
554
676
|
#### Crop Constants (aligned with cognito-check)
|
|
@@ -565,6 +687,30 @@ These constants control how face crops are generated for the `fast-check-crops`
|
|
|
565
687
|
|
|
566
688
|
---
|
|
567
689
|
|
|
690
|
+
### Model Configuration
|
|
691
|
+
|
|
692
|
+
```typescript
|
|
693
|
+
import { MODEL_CONFIGS, isDeprecatedModel, getActiveModels } from '@moveris/shared';
|
|
694
|
+
|
|
695
|
+
// Access model metadata
|
|
696
|
+
const config = MODEL_CONFIGS['mixed-10-v2'];
|
|
697
|
+
console.log(config.minFrames); // 10
|
|
698
|
+
console.log(config.deprecated); // false
|
|
699
|
+
console.log(config.aliases); // ['v2', 'latest']
|
|
700
|
+
|
|
701
|
+
// Check if a model is deprecated
|
|
702
|
+
if (isDeprecatedModel('mixed-10')) {
|
|
703
|
+
const mc = MODEL_CONFIGS['mixed-10'];
|
|
704
|
+
console.log(`Deprecated! Sunset: ${mc.sunsetDate}, replace with ${mc.replacement}`);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// Get only active (non-deprecated) models
|
|
708
|
+
const active = getActiveModels();
|
|
709
|
+
// ['mixed-10-v2', 'mixed-30-v2', ..., '10', '50', '250', 'hybrid-v2-10', ...]
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
568
714
|
## Configuration Constants
|
|
569
715
|
|
|
570
716
|
```typescript
|
|
@@ -588,6 +734,9 @@ import type {
|
|
|
588
734
|
LivenessState,
|
|
589
735
|
LivenessConfig,
|
|
590
736
|
FastCheckModel,
|
|
737
|
+
ModelVersion,
|
|
738
|
+
DeprecationInfo,
|
|
739
|
+
ModelConfig,
|
|
591
740
|
FrameSource,
|
|
592
741
|
Verdict,
|
|
593
742
|
CapturedFrame,
|
package/dist/index.d.mts
CHANGED
|
@@ -5,9 +5,18 @@ interface ModelEntry {
|
|
|
5
5
|
description: string;
|
|
6
6
|
min_frames: number;
|
|
7
7
|
deprecated: boolean;
|
|
8
|
+
aliases?: string[];
|
|
8
9
|
}
|
|
9
10
|
type ModelsResponse = ModelEntry[];
|
|
10
11
|
type FastCheckModel = '10' | '50' | '250' | 'hybrid-v2-10' | 'hybrid-v2-30' | 'hybrid-v2-50' | 'hybrid-v2-60' | 'hybrid-v2-90' | 'hybrid-v2-100' | 'hybrid-v2-125' | 'hybrid-v2-150' | 'hybrid-v2-250' | 'mixed-10' | 'mixed-30' | 'mixed-60' | 'mixed-90' | 'mixed-120' | 'mixed-150' | 'mixed-250' | 'mixed-10-v2' | 'mixed-30-v2' | 'mixed-60-v2' | 'mixed-90-v2' | 'mixed-120-v2' | (string & object);
|
|
12
|
+
type ModelVersion = 'latest' | 'v2' | 'v1' | 'fast' | 'spatial' | 'hybrid' | (string & object);
|
|
13
|
+
interface DeprecationInfo {
|
|
14
|
+
deprecated: boolean;
|
|
15
|
+
resolvedModel: string;
|
|
16
|
+
deprecatedModel?: string;
|
|
17
|
+
sunsetDate?: string;
|
|
18
|
+
suggestedModel?: string;
|
|
19
|
+
}
|
|
11
20
|
type StreamingStatus = 'buffering' | 'complete';
|
|
12
21
|
type FrameSource = 'media' | 'live';
|
|
13
22
|
type JobStatus = 'queued' | 'processing' | 'complete' | 'failed';
|
|
@@ -29,6 +38,7 @@ interface FastCheckRequest {
|
|
|
29
38
|
model?: FastCheckModel;
|
|
30
39
|
source?: FrameSource;
|
|
31
40
|
frames: FrameData[];
|
|
41
|
+
frame_count?: number;
|
|
32
42
|
warnings?: string[];
|
|
33
43
|
}
|
|
34
44
|
interface FastCheckCropsRequest {
|
|
@@ -36,6 +46,7 @@ interface FastCheckCropsRequest {
|
|
|
36
46
|
model?: FastCheckModel;
|
|
37
47
|
source?: FrameSource;
|
|
38
48
|
crops: CropData[];
|
|
49
|
+
frame_count?: number;
|
|
39
50
|
}
|
|
40
51
|
interface VerifyRequest {
|
|
41
52
|
session_id: string;
|
|
@@ -65,6 +76,7 @@ interface FastCheckStreamRequest {
|
|
|
65
76
|
model?: FastCheckModel;
|
|
66
77
|
source?: FrameSource;
|
|
67
78
|
frame: FrameData;
|
|
79
|
+
frame_count?: number;
|
|
68
80
|
warnings?: string[];
|
|
69
81
|
}
|
|
70
82
|
interface FastCheckResponse {
|
|
@@ -162,12 +174,14 @@ interface LivenessResult {
|
|
|
162
174
|
processingMs: number;
|
|
163
175
|
framesProcessed: number;
|
|
164
176
|
warnings?: string[];
|
|
177
|
+
deprecation?: DeprecationInfo;
|
|
165
178
|
}
|
|
166
179
|
type LivenessState = 'idle' | 'capturing' | 'uploading' | 'processing' | 'complete' | 'error';
|
|
167
180
|
interface LivenessConfig {
|
|
168
181
|
baseUrl: string;
|
|
169
182
|
apiKey: string;
|
|
170
183
|
model?: FastCheckModel;
|
|
184
|
+
modelVersion?: ModelVersion;
|
|
171
185
|
source?: FrameSource;
|
|
172
186
|
fps?: number;
|
|
173
187
|
frameCount?: number;
|
|
@@ -180,12 +194,16 @@ interface CapturedFrame {
|
|
|
180
194
|
}
|
|
181
195
|
|
|
182
196
|
type ModelType = FastCheckModel;
|
|
197
|
+
declare const VALID_FRAME_COUNTS: readonly [10, 30, 60, 90, 120];
|
|
183
198
|
interface ModelConfig {
|
|
184
199
|
type: FastCheckModel;
|
|
185
200
|
minFrames: number;
|
|
186
201
|
recommendedFrames: number;
|
|
187
202
|
description: string;
|
|
188
203
|
deprecated: boolean;
|
|
204
|
+
aliases?: string[];
|
|
205
|
+
sunsetDate?: string;
|
|
206
|
+
replacement?: string;
|
|
189
207
|
}
|
|
190
208
|
declare const MODEL_CONFIGS: Record<FastCheckModel, ModelConfig>;
|
|
191
209
|
interface HybridModelConfig {
|
|
@@ -301,7 +319,7 @@ interface FrameQualityResult {
|
|
|
301
319
|
alignment?: FaceAlignmentResult;
|
|
302
320
|
rejectionReason?: 'blur' | 'backlit' | 'low_light' | 'partial_face' | 'no_face' | 'too_close' | 'too_far' | 'misaligned';
|
|
303
321
|
}
|
|
304
|
-
declare const DEFAULT_BLUR_THRESHOLD =
|
|
322
|
+
declare const DEFAULT_BLUR_THRESHOLD = 110;
|
|
305
323
|
declare const BLUR_THRESHOLD_MOBILE = 60;
|
|
306
324
|
declare const BACKLIT_RATIO_THRESHOLD = 0.6;
|
|
307
325
|
declare const LOW_LIGHT_THRESHOLD = 50;
|
|
@@ -353,6 +371,14 @@ interface FaceRollResult {
|
|
|
353
371
|
}
|
|
354
372
|
declare const MAX_FACE_ROLL_DEGREES = 15;
|
|
355
373
|
declare function detectFaceRoll(landmarks: FaceLandmarkPoint[]): FaceRollResult;
|
|
374
|
+
interface CameraAngleResult {
|
|
375
|
+
ratio: number;
|
|
376
|
+
cameraAbove: boolean;
|
|
377
|
+
cameraBelow: boolean;
|
|
378
|
+
}
|
|
379
|
+
declare const CAMERA_ANGLE_HIGH_RATIO = 1.35;
|
|
380
|
+
declare const CAMERA_ANGLE_LOW_RATIO = 0.75;
|
|
381
|
+
declare function detectCameraAngle(landmarks: FaceLandmarkPoint[]): CameraAngleResult;
|
|
356
382
|
declare class BaseFrameCollector {
|
|
357
383
|
protected frames: CapturedFrame[];
|
|
358
384
|
protected maxFrames: number;
|
|
@@ -446,6 +472,7 @@ declare const DEFAULT_STABILIZER_CONFIG: StabilizerConfig;
|
|
|
446
472
|
interface LivenessClientConfig {
|
|
447
473
|
baseUrl?: string;
|
|
448
474
|
apiKey: string;
|
|
475
|
+
modelVersion?: ModelVersion;
|
|
449
476
|
timeout?: number;
|
|
450
477
|
enableRetry?: boolean;
|
|
451
478
|
customFetch?: typeof fetch;
|
|
@@ -465,34 +492,46 @@ declare function generateSessionId(): string;
|
|
|
465
492
|
declare class LivenessClient {
|
|
466
493
|
private readonly baseUrl;
|
|
467
494
|
private readonly apiKey;
|
|
495
|
+
private readonly modelVersion;
|
|
468
496
|
private readonly timeout;
|
|
469
497
|
private readonly enableRetry;
|
|
470
498
|
private readonly fetchFn;
|
|
471
499
|
constructor(config: LivenessClientConfig);
|
|
472
500
|
private request;
|
|
501
|
+
private requestRaw;
|
|
473
502
|
private parseErrorResponse;
|
|
474
503
|
private static unwrapErrorCode;
|
|
475
504
|
private static unwrapErrorMessage;
|
|
476
505
|
private static extractCodeFromText;
|
|
506
|
+
private static parseDeprecationHeaders;
|
|
507
|
+
private buildModelVersionHeaders;
|
|
477
508
|
private requestWithRetry;
|
|
509
|
+
private requestWithRetryRaw;
|
|
478
510
|
health(): Promise<HealthResponse>;
|
|
479
511
|
getModels(): Promise<ModelEntry[]>;
|
|
480
512
|
queueStats(): Promise<QueueStatsResponse>;
|
|
481
513
|
fastCheck(frames: CapturedFrame[], options?: {
|
|
482
514
|
sessionId?: string;
|
|
483
515
|
model?: FastCheckModel;
|
|
516
|
+
modelVersion?: ModelVersion;
|
|
517
|
+
frameCount?: number;
|
|
484
518
|
source?: FrameSource;
|
|
485
519
|
warnings?: string[];
|
|
486
520
|
}): Promise<LivenessResult>;
|
|
487
521
|
fastCheckCrops(crops: CropData[], options?: {
|
|
488
522
|
sessionId?: string;
|
|
489
523
|
model?: FastCheckModel;
|
|
524
|
+
modelVersion?: ModelVersion;
|
|
525
|
+
frameCount?: number;
|
|
490
526
|
source?: FrameSource;
|
|
491
527
|
warnings?: string[];
|
|
528
|
+
bgSegmentation?: boolean;
|
|
492
529
|
}): Promise<LivenessResult>;
|
|
493
530
|
streamFrame(frame: CapturedFrame, options: {
|
|
494
531
|
sessionId: string;
|
|
495
532
|
model?: FastCheckModel;
|
|
533
|
+
modelVersion?: ModelVersion;
|
|
534
|
+
frameCount?: number;
|
|
496
535
|
source?: FrameSource;
|
|
497
536
|
warnings?: string[];
|
|
498
537
|
}): Promise<FastCheckStreamResponse>;
|
|
@@ -500,6 +539,8 @@ declare class LivenessClient {
|
|
|
500
539
|
fastCheckStream(frames: CapturedFrame[], options?: {
|
|
501
540
|
sessionId?: string;
|
|
502
541
|
model?: FastCheckModel;
|
|
542
|
+
modelVersion?: ModelVersion;
|
|
543
|
+
frameCount?: number;
|
|
503
544
|
source?: FrameSource;
|
|
504
545
|
warnings?: string[];
|
|
505
546
|
}, callbacks?: {
|
|
@@ -509,6 +550,8 @@ declare class LivenessClient {
|
|
|
509
550
|
fastCheckStreamSequential(frames: CapturedFrame[], options?: {
|
|
510
551
|
sessionId?: string;
|
|
511
552
|
model?: FastCheckModel;
|
|
553
|
+
modelVersion?: ModelVersion;
|
|
554
|
+
frameCount?: number;
|
|
512
555
|
source?: FrameSource;
|
|
513
556
|
warnings?: string[];
|
|
514
557
|
}, callbacks?: {
|
|
@@ -602,6 +645,7 @@ declare const FRAME_BUFFER_CONFIG: {
|
|
|
602
645
|
declare const AUTH_CONFIG: {
|
|
603
646
|
readonly timeout: 30000;
|
|
604
647
|
readonly apiKeyHeader: "X-API-Key";
|
|
648
|
+
readonly modelVersionHeader: "X-Model-Version";
|
|
605
649
|
};
|
|
606
650
|
declare const FRAME_CONFIG: {
|
|
607
651
|
readonly targetFPS: 30;
|
|
@@ -704,8 +748,9 @@ declare const FEEDBACK_MESSAGES: {
|
|
|
704
748
|
readonly poor_lighting: "Improve lighting";
|
|
705
749
|
readonly too_dark: "Low lighting - move to a brighter area";
|
|
706
750
|
readonly backlit: "Backlit - try facing the light source";
|
|
707
|
-
readonly
|
|
708
|
-
readonly
|
|
751
|
+
readonly camera_angle_low: "Raise camera to eye level";
|
|
752
|
+
readonly camera_angle_high: "Lower camera to eye level";
|
|
753
|
+
readonly camera_tilted: "Hold camera level";
|
|
709
754
|
readonly hand_detected: "Remove hand from face";
|
|
710
755
|
readonly eyes_not_visible: "Eyes not clearly visible";
|
|
711
756
|
readonly eyes_shadowed: "Eyes are in shadow - improve lighting";
|
|
@@ -738,8 +783,9 @@ interface CaptureQualityState {
|
|
|
738
783
|
targetFrames: number;
|
|
739
784
|
tooFarFromIdeal?: boolean;
|
|
740
785
|
tooCloseToIdeal?: boolean;
|
|
741
|
-
|
|
742
|
-
|
|
786
|
+
cameraAngleLow?: boolean;
|
|
787
|
+
cameraAngleHigh?: boolean;
|
|
788
|
+
cameraTilted?: boolean;
|
|
743
789
|
}
|
|
744
790
|
declare function getCaptureQualityFeedback(state: CaptureQualityState): string;
|
|
745
791
|
declare function canCaptureFrame(state: Omit<CaptureQualityState, 'framesCaptured' | 'targetFrames' | 'isCapturing'>): boolean;
|
|
@@ -790,4 +836,4 @@ declare function analyzeEyeRegionContrast(pixels: Uint8Array | Uint8ClampedArray
|
|
|
790
836
|
declare function detectSpecularHighlights(pixels: Uint8Array | Uint8ClampedArray, relativeFactor?: number, meanBrightness?: number): number;
|
|
791
837
|
declare function checkEyeRegionQuality(pixels: Uint8Array | Uint8ClampedArray, thresholds?: EyeQualityThresholds): EyeRegionQuality;
|
|
792
838
|
|
|
793
|
-
export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, type DetectionResult, type DetectionSummary, type DetectorConfig, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_CROP_MULTIPLIER, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelsResponse, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, OVAL_REGION_DESKTOP, OVAL_REGION_MOBILE, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, decodeBase64, detectFaceRoll, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
|
839
|
+
export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_ERROR_CODES, API_PATHS, AUTH_CONFIG, type ApiErrorCode, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, CAMERA_ANGLE_HIGH_RATIO, CAMERA_ANGLE_LOW_RATIO, type CameraAngleResult, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_FACE_DETECTION_TIERS, DEFAULT_GAZE_THRESHOLDS, DEFAULT_HAND_OCCLUSION_CONFIG, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STABILIZER_CONFIG, DEFAULT_STATUS_MESSAGES, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceDetectionTiers, type FaceInOvalResult, type FaceLandmarkPoint, type FaceRollResult, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FastCheckStreamRequest, type FastCheckStreamResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, type GazeThresholds, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HandOcclusionConfig, type HeadPose, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_CROP_MULTIPLIER, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MIN_IDEAL_FACE_RATIO, MIN_LANDMARK_COUNT, MODEL_CONFIGS, type ModelConfig, type ModelEntry, type ModelType, type ModelVersion, type ModelsResponse, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, OVAL_REGION_DESKTOP, OVAL_REGION_MOBILE, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StabilizationProgress, type StabilizationResult, type StabilizerConfig, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, VALID_FRAME_COUNTS, type Verdict, type VerifyRequest, type VerifyResponse, type VideoFrameMetadata, analyzeBlur, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, decodeBase64, detectCameraAngle, detectFaceRoll, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|