@moveris/shared 3.11.0 → 3.13.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 +38 -3
- package/dist/index.d.mts +38 -3
- package/dist/index.d.ts +38 -3
- package/dist/index.js +115 -7
- package/dist/index.mjs +115 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -213,18 +213,42 @@ Model selection for liveness detection speed/accuracy trade-off.
|
|
|
213
213
|
|
|
214
214
|
```typescript
|
|
215
215
|
type FastCheckModel =
|
|
216
|
+
| 'mixed-10-v3_1'
|
|
217
|
+
| 'mixed-30-v3_1'
|
|
218
|
+
| 'mixed-60-v3_1'
|
|
219
|
+
| 'mixed-90-v3_1' // Mixed v3_1 models (latest)
|
|
220
|
+
| 'mixed-10-v3'
|
|
221
|
+
| 'mixed-30-v3'
|
|
222
|
+
| 'mixed-60-v3' // Mixed v3 models
|
|
216
223
|
| 'mixed-10-v2'
|
|
217
224
|
| 'mixed-30-v2'
|
|
218
225
|
| 'mixed-60-v2'
|
|
219
226
|
| 'mixed-90-v2'
|
|
220
|
-
| 'mixed-120-v2' //
|
|
227
|
+
| 'mixed-120-v2' // Mixed v2 models
|
|
221
228
|
| '10'
|
|
222
229
|
| '50'
|
|
223
230
|
| '250' // Legacy standard models
|
|
224
231
|
| (string & object); // Forward-compatible with future model IDs
|
|
225
232
|
```
|
|
226
233
|
|
|
227
|
-
|
|
234
|
+
Mixed v3_1 models (alias: `'v3_1'`):
|
|
235
|
+
|
|
236
|
+
| Value | Frames | Description |
|
|
237
|
+
| ----------------- | ------ | ------------------------------ |
|
|
238
|
+
| `'mixed-10-v3_1'` | 10 | Fast verification, low latency |
|
|
239
|
+
| `'mixed-30-v3_1'` | 30 | Balanced speed and accuracy |
|
|
240
|
+
| `'mixed-60-v3_1'` | 60 | Higher accuracy |
|
|
241
|
+
| `'mixed-90-v3_1'` | 90 | High accuracy |
|
|
242
|
+
|
|
243
|
+
Mixed v3 models (alias: `'v3'`):
|
|
244
|
+
|
|
245
|
+
| Value | Frames | Description |
|
|
246
|
+
| --------------- | ------ | ------------------------------ |
|
|
247
|
+
| `'mixed-10-v3'` | 10 | Fast verification, low latency |
|
|
248
|
+
| `'mixed-30-v3'` | 30 | Balanced speed and accuracy |
|
|
249
|
+
| `'mixed-60-v3'` | 60 | Higher accuracy |
|
|
250
|
+
|
|
251
|
+
Mixed v2 models (alias: `'v2'`):
|
|
228
252
|
|
|
229
253
|
| Value | Frames | Description |
|
|
230
254
|
| ---------------- | ------ | ------------------------------ |
|
|
@@ -374,12 +398,23 @@ interface CropData {
|
|
|
374
398
|
Version alias sent via the `X-Model-Version` request header for server-side model resolution.
|
|
375
399
|
|
|
376
400
|
```typescript
|
|
377
|
-
type ModelVersion =
|
|
401
|
+
type ModelVersion =
|
|
402
|
+
| 'latest'
|
|
403
|
+
| 'v3_1'
|
|
404
|
+
| 'v3'
|
|
405
|
+
| 'v2'
|
|
406
|
+
| 'v1'
|
|
407
|
+
| 'fast'
|
|
408
|
+
| 'spatial'
|
|
409
|
+
| 'hybrid'
|
|
410
|
+
| (string & object);
|
|
378
411
|
```
|
|
379
412
|
|
|
380
413
|
| Value | Resolves to |
|
|
381
414
|
| ----------- | ----------------------------------- |
|
|
382
415
|
| `'latest'` | Current production mixed-v2 model |
|
|
416
|
+
| `'v3_1'` | Mixed v3_1 models |
|
|
417
|
+
| `'v3'` | Mixed v3 models |
|
|
383
418
|
| `'v2'` | Pinned mixed-v2 version |
|
|
384
419
|
| `'v1'` | Legacy mixed-v1 models (deprecated) |
|
|
385
420
|
| `'fast'` | Model `'10'` |
|
package/dist/index.d.mts
CHANGED
|
@@ -42,8 +42,8 @@ interface ModelEntry {
|
|
|
42
42
|
aliases?: string[];
|
|
43
43
|
}
|
|
44
44
|
type ModelsResponse = ModelEntry[];
|
|
45
|
-
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);
|
|
46
|
-
type ModelVersion = 'latest' | 'v2' | '
|
|
45
|
+
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' | 'mixed-10-v3' | 'mixed-30-v3' | 'mixed-60-v3' | 'mixed-10-v3_1' | 'mixed-30-v3_1' | 'mixed-60-v3_1' | 'mixed-90-v3_1' | (string & object);
|
|
46
|
+
type ModelVersion = 'latest' | 'v1' | 'v2' | 'v3' | 'v3_1' | 'fast' | 'spatial' | 'hybrid' | (string & object);
|
|
47
47
|
interface DeprecationInfo {
|
|
48
48
|
deprecated: boolean;
|
|
49
49
|
resolvedModel: string;
|
|
@@ -59,6 +59,13 @@ interface FrameData {
|
|
|
59
59
|
timestamp_ms: number;
|
|
60
60
|
pixels: string;
|
|
61
61
|
}
|
|
62
|
+
interface LiveCheckFrameData extends FrameData {
|
|
63
|
+
landmarks: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
z: number;
|
|
67
|
+
}[] | null;
|
|
68
|
+
}
|
|
62
69
|
interface CropData {
|
|
63
70
|
index: number;
|
|
64
71
|
pixels: string;
|
|
@@ -79,6 +86,18 @@ interface FastCheckRequest {
|
|
|
79
86
|
consumer?: ConsumerContext;
|
|
80
87
|
} | null;
|
|
81
88
|
}
|
|
89
|
+
interface LiveCheckRequest {
|
|
90
|
+
session_id: string;
|
|
91
|
+
model?: FastCheckModel;
|
|
92
|
+
source?: FrameSource;
|
|
93
|
+
frames: LiveCheckFrameData[];
|
|
94
|
+
frame_count?: number;
|
|
95
|
+
warnings?: string[];
|
|
96
|
+
device_intelligence?: DeviceIntelligence;
|
|
97
|
+
metadata?: {
|
|
98
|
+
consumer?: ConsumerContext;
|
|
99
|
+
} | null;
|
|
100
|
+
}
|
|
82
101
|
interface FastCheckCropsRequest {
|
|
83
102
|
session_id: string;
|
|
84
103
|
model?: FastCheckModel;
|
|
@@ -138,6 +157,7 @@ interface FastCheckResponse {
|
|
|
138
157
|
warning: string | null;
|
|
139
158
|
warnings?: string[] | null;
|
|
140
159
|
error: string | null;
|
|
160
|
+
diagnostics?: Record<string, unknown> | null;
|
|
141
161
|
}
|
|
142
162
|
interface FastCheckStreamResponse {
|
|
143
163
|
status: StreamingStatus;
|
|
@@ -225,6 +245,7 @@ interface LivenessResult {
|
|
|
225
245
|
warnings?: string[];
|
|
226
246
|
deprecation?: DeprecationInfo;
|
|
227
247
|
clientTime?: number;
|
|
248
|
+
diagnostics?: Record<string, unknown> | null;
|
|
228
249
|
}
|
|
229
250
|
type LivenessState = 'idle' | 'capturing' | 'uploading' | 'processing' | 'complete' | 'error';
|
|
230
251
|
interface LivenessConfig {
|
|
@@ -241,6 +262,11 @@ interface CapturedFrame {
|
|
|
241
262
|
index: number;
|
|
242
263
|
timestampMs: number;
|
|
243
264
|
pixels: string;
|
|
265
|
+
landmarks?: {
|
|
266
|
+
x: number;
|
|
267
|
+
y: number;
|
|
268
|
+
z: number;
|
|
269
|
+
}[] | null;
|
|
244
270
|
}
|
|
245
271
|
|
|
246
272
|
type ModelType = FastCheckModel;
|
|
@@ -640,6 +666,14 @@ declare class LivenessClient {
|
|
|
640
666
|
source?: FrameSource;
|
|
641
667
|
warnings?: string[];
|
|
642
668
|
}): Promise<LivenessResult>;
|
|
669
|
+
liveCheck(frames: CapturedFrame[], options?: {
|
|
670
|
+
sessionId?: string;
|
|
671
|
+
model?: FastCheckModel;
|
|
672
|
+
modelVersion?: ModelVersion;
|
|
673
|
+
frameCount?: number;
|
|
674
|
+
source?: FrameSource;
|
|
675
|
+
warnings?: string[];
|
|
676
|
+
}): Promise<LivenessResult>;
|
|
643
677
|
fastCheckCrops(crops: CropData[], options?: {
|
|
644
678
|
sessionId?: string;
|
|
645
679
|
model?: FastCheckModel;
|
|
@@ -747,6 +781,7 @@ declare const API_PATHS: {
|
|
|
747
781
|
readonly fastCheck: "/api/v1/fast-check";
|
|
748
782
|
readonly fastCheckCrops: "/api/v1/fast-check-crops";
|
|
749
783
|
readonly fastCheckStream: "/api/v1/fast-check-stream";
|
|
784
|
+
readonly liveCheck: "/api/v1/live-check";
|
|
750
785
|
readonly verify: "/api/v1/verify";
|
|
751
786
|
readonly hybridCheck: "/api/v1/hybrid-check";
|
|
752
787
|
readonly hybrid50: "/api/v1/hybrid-50";
|
|
@@ -968,4 +1003,4 @@ declare function collectDeviceIntelligence(opts?: {
|
|
|
968
1003
|
platformVersion?: string;
|
|
969
1004
|
}): Promise<DeviceIntelligence | null>;
|
|
970
1005
|
|
|
971
|
-
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 CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type ExtraMetadata, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, 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, 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_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, 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, SHARED_SDK_PLATFORM, 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, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
|
1006
|
+
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 CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type ExtraMetadata, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, 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, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, type LiveCheckFrameData, type LiveCheckRequest, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, 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, SHARED_SDK_PLATFORM, 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, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -42,8 +42,8 @@ interface ModelEntry {
|
|
|
42
42
|
aliases?: string[];
|
|
43
43
|
}
|
|
44
44
|
type ModelsResponse = ModelEntry[];
|
|
45
|
-
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);
|
|
46
|
-
type ModelVersion = 'latest' | 'v2' | '
|
|
45
|
+
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' | 'mixed-10-v3' | 'mixed-30-v3' | 'mixed-60-v3' | 'mixed-10-v3_1' | 'mixed-30-v3_1' | 'mixed-60-v3_1' | 'mixed-90-v3_1' | (string & object);
|
|
46
|
+
type ModelVersion = 'latest' | 'v1' | 'v2' | 'v3' | 'v3_1' | 'fast' | 'spatial' | 'hybrid' | (string & object);
|
|
47
47
|
interface DeprecationInfo {
|
|
48
48
|
deprecated: boolean;
|
|
49
49
|
resolvedModel: string;
|
|
@@ -59,6 +59,13 @@ interface FrameData {
|
|
|
59
59
|
timestamp_ms: number;
|
|
60
60
|
pixels: string;
|
|
61
61
|
}
|
|
62
|
+
interface LiveCheckFrameData extends FrameData {
|
|
63
|
+
landmarks: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
z: number;
|
|
67
|
+
}[] | null;
|
|
68
|
+
}
|
|
62
69
|
interface CropData {
|
|
63
70
|
index: number;
|
|
64
71
|
pixels: string;
|
|
@@ -79,6 +86,18 @@ interface FastCheckRequest {
|
|
|
79
86
|
consumer?: ConsumerContext;
|
|
80
87
|
} | null;
|
|
81
88
|
}
|
|
89
|
+
interface LiveCheckRequest {
|
|
90
|
+
session_id: string;
|
|
91
|
+
model?: FastCheckModel;
|
|
92
|
+
source?: FrameSource;
|
|
93
|
+
frames: LiveCheckFrameData[];
|
|
94
|
+
frame_count?: number;
|
|
95
|
+
warnings?: string[];
|
|
96
|
+
device_intelligence?: DeviceIntelligence;
|
|
97
|
+
metadata?: {
|
|
98
|
+
consumer?: ConsumerContext;
|
|
99
|
+
} | null;
|
|
100
|
+
}
|
|
82
101
|
interface FastCheckCropsRequest {
|
|
83
102
|
session_id: string;
|
|
84
103
|
model?: FastCheckModel;
|
|
@@ -138,6 +157,7 @@ interface FastCheckResponse {
|
|
|
138
157
|
warning: string | null;
|
|
139
158
|
warnings?: string[] | null;
|
|
140
159
|
error: string | null;
|
|
160
|
+
diagnostics?: Record<string, unknown> | null;
|
|
141
161
|
}
|
|
142
162
|
interface FastCheckStreamResponse {
|
|
143
163
|
status: StreamingStatus;
|
|
@@ -225,6 +245,7 @@ interface LivenessResult {
|
|
|
225
245
|
warnings?: string[];
|
|
226
246
|
deprecation?: DeprecationInfo;
|
|
227
247
|
clientTime?: number;
|
|
248
|
+
diagnostics?: Record<string, unknown> | null;
|
|
228
249
|
}
|
|
229
250
|
type LivenessState = 'idle' | 'capturing' | 'uploading' | 'processing' | 'complete' | 'error';
|
|
230
251
|
interface LivenessConfig {
|
|
@@ -241,6 +262,11 @@ interface CapturedFrame {
|
|
|
241
262
|
index: number;
|
|
242
263
|
timestampMs: number;
|
|
243
264
|
pixels: string;
|
|
265
|
+
landmarks?: {
|
|
266
|
+
x: number;
|
|
267
|
+
y: number;
|
|
268
|
+
z: number;
|
|
269
|
+
}[] | null;
|
|
244
270
|
}
|
|
245
271
|
|
|
246
272
|
type ModelType = FastCheckModel;
|
|
@@ -640,6 +666,14 @@ declare class LivenessClient {
|
|
|
640
666
|
source?: FrameSource;
|
|
641
667
|
warnings?: string[];
|
|
642
668
|
}): Promise<LivenessResult>;
|
|
669
|
+
liveCheck(frames: CapturedFrame[], options?: {
|
|
670
|
+
sessionId?: string;
|
|
671
|
+
model?: FastCheckModel;
|
|
672
|
+
modelVersion?: ModelVersion;
|
|
673
|
+
frameCount?: number;
|
|
674
|
+
source?: FrameSource;
|
|
675
|
+
warnings?: string[];
|
|
676
|
+
}): Promise<LivenessResult>;
|
|
643
677
|
fastCheckCrops(crops: CropData[], options?: {
|
|
644
678
|
sessionId?: string;
|
|
645
679
|
model?: FastCheckModel;
|
|
@@ -747,6 +781,7 @@ declare const API_PATHS: {
|
|
|
747
781
|
readonly fastCheck: "/api/v1/fast-check";
|
|
748
782
|
readonly fastCheckCrops: "/api/v1/fast-check-crops";
|
|
749
783
|
readonly fastCheckStream: "/api/v1/fast-check-stream";
|
|
784
|
+
readonly liveCheck: "/api/v1/live-check";
|
|
750
785
|
readonly verify: "/api/v1/verify";
|
|
751
786
|
readonly hybridCheck: "/api/v1/hybrid-check";
|
|
752
787
|
readonly hybrid50: "/api/v1/hybrid-50";
|
|
@@ -968,4 +1003,4 @@ declare function collectDeviceIntelligence(opts?: {
|
|
|
968
1003
|
platformVersion?: string;
|
|
969
1004
|
}): Promise<DeviceIntelligence | null>;
|
|
970
1005
|
|
|
971
|
-
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 CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type ExtraMetadata, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, 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, 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_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, 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, SHARED_SDK_PLATFORM, 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, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
|
1006
|
+
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 CameraCapabilities, type CameraRequirements, type CameraValidationResult, type CaptureQualityState, type CapturedFrame, type ConsumerContext, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_CAMERA_REQUIREMENTS, 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, DYNAMIC_RANGE_WARNING_THRESHOLD, type DeprecationInfo, type DetectionResult, type DetectionSummary, type DetectorConfig, type DeviceIntelligence, type DeviceIntelligenceCamera, type DeviceIntelligenceGeo, type DeviceIntelligenceOverrides, type DynamicRangeAnalysis, ERROR_MESSAGES, ERROR_MESSAGES_ES, ES_LOCALE, EYE_LANDMARK_INDICES, EYE_QUALITY_THRESHOLDS, type ErrorResponse, type ExtraMetadata, type EyeQualityThresholds, type EyeRegionBounds, type EyeRegionQuality, type EyeRegionsBounds, FACE_CROP_FRAME_MARGIN, 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, type JobStatus, type JobStatusResponse, LANDMARK_INDEX, LANDMARK_MAX_BOUND, LANDMARK_MIN_BOUND, LOW_LIGHT_THRESHOLD, type LandmarkValidationResult, type LightingAnalysis, type LiveCheckFrameData, type LiveCheckRequest, LivenessApiError, type LivenessCallbacks, LivenessClient, type LivenessClientConfig, type LivenessConfig, type LivenessResult, type LivenessState, MAX_FACE_PERCENTAGE_IN_CROP, MAX_FACE_RATIO, MAX_FACE_ROLL_DEGREES, MAX_IDEAL_FACE_RATIO, MIN_CAPTURE_ALIGNMENT, MIN_FACE_AREA_RATIO, 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, SHARED_SDK_PLATFORM, 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, analyzeDynamicRange, analyzeEyeRegionBrightness, analyzeEyeRegionContrast, analyzeLighting, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkEyeRegionQuality, checkFrameQuality, collectDeviceIntelligence, decodeBase64, detectCameraAngle, detectFaceRoll, detectFaceRollFromMatrix, detectSpecularHighlights, encodeBase64, generateSessionId, getActiveModels, getApiErrorMessage, getCaptureQualityFeedback, getEyeRegionBounds, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isDeprecatedModel, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, isRetryableError, linearRgbToLabL, retryWithBackoff, rgbaToGrayscale, sleep, srgbToLinear, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFaceLandmarks, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
|
package/dist/index.js
CHANGED
|
@@ -153,6 +153,8 @@ var API_PATHS = {
|
|
|
153
153
|
fastCheck: "/api/v1/fast-check",
|
|
154
154
|
fastCheckCrops: "/api/v1/fast-check-crops",
|
|
155
155
|
fastCheckStream: "/api/v1/fast-check-stream",
|
|
156
|
+
/** Live-check prototype (Phase 2): SDK-supplied landmarks per frame. */
|
|
157
|
+
liveCheck: "/api/v1/live-check",
|
|
156
158
|
verify: "/api/v1/verify",
|
|
157
159
|
hybridCheck: "/api/v1/hybrid-check",
|
|
158
160
|
hybrid50: "/api/v1/hybrid-50",
|
|
@@ -239,7 +241,7 @@ async function sleep(ms) {
|
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
// package.json
|
|
242
|
-
var version = "3.
|
|
244
|
+
var version = "3.13.0";
|
|
243
245
|
|
|
244
246
|
// src/utils/deviceIntelligence.ts
|
|
245
247
|
var IPINFO_URL = "https://ipinfo.io/json";
|
|
@@ -298,6 +300,14 @@ var LivenessApiError = class extends Error {
|
|
|
298
300
|
this.received = received;
|
|
299
301
|
}
|
|
300
302
|
};
|
|
303
|
+
function toLiveCheckFrameData(frames) {
|
|
304
|
+
return frames.map((frame) => ({
|
|
305
|
+
index: frame.index,
|
|
306
|
+
timestamp_ms: frame.timestampMs,
|
|
307
|
+
pixels: frame.pixels,
|
|
308
|
+
landmarks: frame.landmarks ? frame.landmarks.map((lm) => ({ x: lm.x, y: lm.y, z: lm.z })) : null
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
301
311
|
function toFrameData(frames) {
|
|
302
312
|
return frames.map((frame) => ({
|
|
303
313
|
index: frame.index,
|
|
@@ -333,7 +343,10 @@ function toLivenessResult(response) {
|
|
|
333
343
|
sessionId: response.session_id,
|
|
334
344
|
processingMs: response.processing_ms,
|
|
335
345
|
framesProcessed: "frames_processed" in response ? response.frames_processed ?? 0 : 0,
|
|
336
|
-
warnings: "warnings" in response && Array.isArray(response.warnings) ? response.warnings : void 0
|
|
346
|
+
warnings: "warnings" in response && Array.isArray(response.warnings) ? response.warnings : void 0,
|
|
347
|
+
// Live-check prototype: surface the server diagnostics block so the
|
|
348
|
+
// demo can log it. Production fast-check leaves this off the wire.
|
|
349
|
+
..."diagnostics" in response && response.diagnostics != null ? { diagnostics: response.diagnostics } : {}
|
|
337
350
|
};
|
|
338
351
|
}
|
|
339
352
|
function toLivenessResultFromStream(response) {
|
|
@@ -453,15 +466,16 @@ var LivenessClient = class _LivenessClient {
|
|
|
453
466
|
const url = `${this.baseUrl}${path}`;
|
|
454
467
|
const controller = new AbortController();
|
|
455
468
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
469
|
+
const mergedHeaders = {
|
|
470
|
+
"Content-Type": "application/json",
|
|
471
|
+
[AUTH_CONFIG.apiKeyHeader]: this.apiKey,
|
|
472
|
+
...options.headers
|
|
473
|
+
};
|
|
456
474
|
try {
|
|
457
475
|
const response = await this.fetchFn(url, {
|
|
458
476
|
...options,
|
|
459
477
|
signal: controller.signal,
|
|
460
|
-
headers:
|
|
461
|
-
"Content-Type": "application/json",
|
|
462
|
-
[AUTH_CONFIG.apiKeyHeader]: this.apiKey,
|
|
463
|
-
...options.headers
|
|
464
|
-
}
|
|
478
|
+
headers: mergedHeaders
|
|
465
479
|
});
|
|
466
480
|
clearTimeout(timeoutId);
|
|
467
481
|
if (!response.ok) {
|
|
@@ -704,6 +718,42 @@ var LivenessClient = class _LivenessClient {
|
|
|
704
718
|
}
|
|
705
719
|
return result;
|
|
706
720
|
}
|
|
721
|
+
/**
|
|
722
|
+
* Live-check prototype (Phase 2): same payload shape as ``fastCheck``
|
|
723
|
+
* plus the MediaPipe Face Mesh landmarks the SDK already computed for
|
|
724
|
+
* each frame. The server uses those landmarks to skip its own
|
|
725
|
+
* MediaPipe Face Detection + Face Mesh calls — typically a 5–15s
|
|
726
|
+
* server-side win on V3.1 models.
|
|
727
|
+
*
|
|
728
|
+
* Required: every frame must include `landmarks` (a 468-entry array
|
|
729
|
+
* of `{x, y, z}` from MediaPipe Face Mesh). Frames whose `landmarks`
|
|
730
|
+
* is `null` flow through cleanly and are dropped server-side.
|
|
731
|
+
*/
|
|
732
|
+
async liveCheck(frames, options = {}) {
|
|
733
|
+
const effectiveVersion = options.modelVersion ?? this.modelVersion;
|
|
734
|
+
const di = await this.getDeviceIntelligence();
|
|
735
|
+
const request = {
|
|
736
|
+
session_id: options.sessionId ?? generateSessionId(),
|
|
737
|
+
model: options.model ?? "10",
|
|
738
|
+
source: options.source ?? "live",
|
|
739
|
+
frames: toLiveCheckFrameData(frames),
|
|
740
|
+
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
741
|
+
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
742
|
+
...di ? { device_intelligence: di } : {},
|
|
743
|
+
...this.buildMetadata() ? { metadata: this.buildMetadata() } : {}
|
|
744
|
+
};
|
|
745
|
+
const { data: response, headers } = await this.requestWithRetryRaw(
|
|
746
|
+
API_PATHS.liveCheck,
|
|
747
|
+
{
|
|
748
|
+
method: "POST",
|
|
749
|
+
body: JSON.stringify(request),
|
|
750
|
+
headers: this.buildModelVersionHeaders(effectiveVersion)
|
|
751
|
+
}
|
|
752
|
+
);
|
|
753
|
+
const result = toLivenessResult(response);
|
|
754
|
+
result.deprecation = _LivenessClient.parseDeprecationHeaders(headers);
|
|
755
|
+
return result;
|
|
756
|
+
}
|
|
707
757
|
/**
|
|
708
758
|
* Perform fast liveness check with pre-cropped face images
|
|
709
759
|
*
|
|
@@ -1357,6 +1407,64 @@ var MODEL_CONFIGS = {
|
|
|
1357
1407
|
description: "Mixed V2 120-frame model",
|
|
1358
1408
|
deprecated: false,
|
|
1359
1409
|
aliases: ["latest", "v2"]
|
|
1410
|
+
},
|
|
1411
|
+
// Mixed V3 models
|
|
1412
|
+
"mixed-10-v3": {
|
|
1413
|
+
type: "mixed-10-v3",
|
|
1414
|
+
minFrames: 10,
|
|
1415
|
+
recommendedFrames: 10,
|
|
1416
|
+
description: "Mixed V3 10-frame model",
|
|
1417
|
+
deprecated: false,
|
|
1418
|
+
aliases: ["v3"]
|
|
1419
|
+
},
|
|
1420
|
+
"mixed-30-v3": {
|
|
1421
|
+
type: "mixed-30-v3",
|
|
1422
|
+
minFrames: 30,
|
|
1423
|
+
recommendedFrames: 30,
|
|
1424
|
+
description: "Mixed V3 30-frame model",
|
|
1425
|
+
deprecated: false,
|
|
1426
|
+
aliases: ["v3"]
|
|
1427
|
+
},
|
|
1428
|
+
"mixed-60-v3": {
|
|
1429
|
+
type: "mixed-60-v3",
|
|
1430
|
+
minFrames: 60,
|
|
1431
|
+
recommendedFrames: 60,
|
|
1432
|
+
description: "Mixed V3 60-frame model",
|
|
1433
|
+
deprecated: false,
|
|
1434
|
+
aliases: ["v3"]
|
|
1435
|
+
},
|
|
1436
|
+
// Mixed V3_1 models
|
|
1437
|
+
"mixed-10-v3_1": {
|
|
1438
|
+
type: "mixed-10-v3_1",
|
|
1439
|
+
minFrames: 10,
|
|
1440
|
+
recommendedFrames: 10,
|
|
1441
|
+
description: "Mixed V3.1 10-frame model",
|
|
1442
|
+
deprecated: false,
|
|
1443
|
+
aliases: ["v3_1"]
|
|
1444
|
+
},
|
|
1445
|
+
"mixed-30-v3_1": {
|
|
1446
|
+
type: "mixed-30-v3_1",
|
|
1447
|
+
minFrames: 30,
|
|
1448
|
+
recommendedFrames: 30,
|
|
1449
|
+
description: "Mixed V3.1 30-frame model",
|
|
1450
|
+
deprecated: false,
|
|
1451
|
+
aliases: ["v3_1"]
|
|
1452
|
+
},
|
|
1453
|
+
"mixed-60-v3_1": {
|
|
1454
|
+
type: "mixed-60-v3_1",
|
|
1455
|
+
minFrames: 60,
|
|
1456
|
+
recommendedFrames: 60,
|
|
1457
|
+
description: "Mixed V3.1 60-frame model",
|
|
1458
|
+
deprecated: false,
|
|
1459
|
+
aliases: ["v3_1"]
|
|
1460
|
+
},
|
|
1461
|
+
"mixed-90-v3_1": {
|
|
1462
|
+
type: "mixed-90-v3_1",
|
|
1463
|
+
minFrames: 90,
|
|
1464
|
+
recommendedFrames: 90,
|
|
1465
|
+
description: "Mixed V3.1 90-frame model",
|
|
1466
|
+
deprecated: false,
|
|
1467
|
+
aliases: ["v3_1"]
|
|
1360
1468
|
}
|
|
1361
1469
|
};
|
|
1362
1470
|
var HYBRID_MODEL_CONFIGS = {
|
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,8 @@ var API_PATHS = {
|
|
|
11
11
|
fastCheck: "/api/v1/fast-check",
|
|
12
12
|
fastCheckCrops: "/api/v1/fast-check-crops",
|
|
13
13
|
fastCheckStream: "/api/v1/fast-check-stream",
|
|
14
|
+
/** Live-check prototype (Phase 2): SDK-supplied landmarks per frame. */
|
|
15
|
+
liveCheck: "/api/v1/live-check",
|
|
14
16
|
verify: "/api/v1/verify",
|
|
15
17
|
hybridCheck: "/api/v1/hybrid-check",
|
|
16
18
|
hybrid50: "/api/v1/hybrid-50",
|
|
@@ -97,7 +99,7 @@ async function sleep(ms) {
|
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
// package.json
|
|
100
|
-
var version = "3.
|
|
102
|
+
var version = "3.13.0";
|
|
101
103
|
|
|
102
104
|
// src/utils/deviceIntelligence.ts
|
|
103
105
|
var IPINFO_URL = "https://ipinfo.io/json";
|
|
@@ -156,6 +158,14 @@ var LivenessApiError = class extends Error {
|
|
|
156
158
|
this.received = received;
|
|
157
159
|
}
|
|
158
160
|
};
|
|
161
|
+
function toLiveCheckFrameData(frames) {
|
|
162
|
+
return frames.map((frame) => ({
|
|
163
|
+
index: frame.index,
|
|
164
|
+
timestamp_ms: frame.timestampMs,
|
|
165
|
+
pixels: frame.pixels,
|
|
166
|
+
landmarks: frame.landmarks ? frame.landmarks.map((lm) => ({ x: lm.x, y: lm.y, z: lm.z })) : null
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
159
169
|
function toFrameData(frames) {
|
|
160
170
|
return frames.map((frame) => ({
|
|
161
171
|
index: frame.index,
|
|
@@ -191,7 +201,10 @@ function toLivenessResult(response) {
|
|
|
191
201
|
sessionId: response.session_id,
|
|
192
202
|
processingMs: response.processing_ms,
|
|
193
203
|
framesProcessed: "frames_processed" in response ? response.frames_processed ?? 0 : 0,
|
|
194
|
-
warnings: "warnings" in response && Array.isArray(response.warnings) ? response.warnings : void 0
|
|
204
|
+
warnings: "warnings" in response && Array.isArray(response.warnings) ? response.warnings : void 0,
|
|
205
|
+
// Live-check prototype: surface the server diagnostics block so the
|
|
206
|
+
// demo can log it. Production fast-check leaves this off the wire.
|
|
207
|
+
..."diagnostics" in response && response.diagnostics != null ? { diagnostics: response.diagnostics } : {}
|
|
195
208
|
};
|
|
196
209
|
}
|
|
197
210
|
function toLivenessResultFromStream(response) {
|
|
@@ -311,15 +324,16 @@ var LivenessClient = class _LivenessClient {
|
|
|
311
324
|
const url = `${this.baseUrl}${path}`;
|
|
312
325
|
const controller = new AbortController();
|
|
313
326
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
327
|
+
const mergedHeaders = {
|
|
328
|
+
"Content-Type": "application/json",
|
|
329
|
+
[AUTH_CONFIG.apiKeyHeader]: this.apiKey,
|
|
330
|
+
...options.headers
|
|
331
|
+
};
|
|
314
332
|
try {
|
|
315
333
|
const response = await this.fetchFn(url, {
|
|
316
334
|
...options,
|
|
317
335
|
signal: controller.signal,
|
|
318
|
-
headers:
|
|
319
|
-
"Content-Type": "application/json",
|
|
320
|
-
[AUTH_CONFIG.apiKeyHeader]: this.apiKey,
|
|
321
|
-
...options.headers
|
|
322
|
-
}
|
|
336
|
+
headers: mergedHeaders
|
|
323
337
|
});
|
|
324
338
|
clearTimeout(timeoutId);
|
|
325
339
|
if (!response.ok) {
|
|
@@ -562,6 +576,42 @@ var LivenessClient = class _LivenessClient {
|
|
|
562
576
|
}
|
|
563
577
|
return result;
|
|
564
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* Live-check prototype (Phase 2): same payload shape as ``fastCheck``
|
|
581
|
+
* plus the MediaPipe Face Mesh landmarks the SDK already computed for
|
|
582
|
+
* each frame. The server uses those landmarks to skip its own
|
|
583
|
+
* MediaPipe Face Detection + Face Mesh calls — typically a 5–15s
|
|
584
|
+
* server-side win on V3.1 models.
|
|
585
|
+
*
|
|
586
|
+
* Required: every frame must include `landmarks` (a 468-entry array
|
|
587
|
+
* of `{x, y, z}` from MediaPipe Face Mesh). Frames whose `landmarks`
|
|
588
|
+
* is `null` flow through cleanly and are dropped server-side.
|
|
589
|
+
*/
|
|
590
|
+
async liveCheck(frames, options = {}) {
|
|
591
|
+
const effectiveVersion = options.modelVersion ?? this.modelVersion;
|
|
592
|
+
const di = await this.getDeviceIntelligence();
|
|
593
|
+
const request = {
|
|
594
|
+
session_id: options.sessionId ?? generateSessionId(),
|
|
595
|
+
model: options.model ?? "10",
|
|
596
|
+
source: options.source ?? "live",
|
|
597
|
+
frames: toLiveCheckFrameData(frames),
|
|
598
|
+
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
599
|
+
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
600
|
+
...di ? { device_intelligence: di } : {},
|
|
601
|
+
...this.buildMetadata() ? { metadata: this.buildMetadata() } : {}
|
|
602
|
+
};
|
|
603
|
+
const { data: response, headers } = await this.requestWithRetryRaw(
|
|
604
|
+
API_PATHS.liveCheck,
|
|
605
|
+
{
|
|
606
|
+
method: "POST",
|
|
607
|
+
body: JSON.stringify(request),
|
|
608
|
+
headers: this.buildModelVersionHeaders(effectiveVersion)
|
|
609
|
+
}
|
|
610
|
+
);
|
|
611
|
+
const result = toLivenessResult(response);
|
|
612
|
+
result.deprecation = _LivenessClient.parseDeprecationHeaders(headers);
|
|
613
|
+
return result;
|
|
614
|
+
}
|
|
565
615
|
/**
|
|
566
616
|
* Perform fast liveness check with pre-cropped face images
|
|
567
617
|
*
|
|
@@ -1215,6 +1265,64 @@ var MODEL_CONFIGS = {
|
|
|
1215
1265
|
description: "Mixed V2 120-frame model",
|
|
1216
1266
|
deprecated: false,
|
|
1217
1267
|
aliases: ["latest", "v2"]
|
|
1268
|
+
},
|
|
1269
|
+
// Mixed V3 models
|
|
1270
|
+
"mixed-10-v3": {
|
|
1271
|
+
type: "mixed-10-v3",
|
|
1272
|
+
minFrames: 10,
|
|
1273
|
+
recommendedFrames: 10,
|
|
1274
|
+
description: "Mixed V3 10-frame model",
|
|
1275
|
+
deprecated: false,
|
|
1276
|
+
aliases: ["v3"]
|
|
1277
|
+
},
|
|
1278
|
+
"mixed-30-v3": {
|
|
1279
|
+
type: "mixed-30-v3",
|
|
1280
|
+
minFrames: 30,
|
|
1281
|
+
recommendedFrames: 30,
|
|
1282
|
+
description: "Mixed V3 30-frame model",
|
|
1283
|
+
deprecated: false,
|
|
1284
|
+
aliases: ["v3"]
|
|
1285
|
+
},
|
|
1286
|
+
"mixed-60-v3": {
|
|
1287
|
+
type: "mixed-60-v3",
|
|
1288
|
+
minFrames: 60,
|
|
1289
|
+
recommendedFrames: 60,
|
|
1290
|
+
description: "Mixed V3 60-frame model",
|
|
1291
|
+
deprecated: false,
|
|
1292
|
+
aliases: ["v3"]
|
|
1293
|
+
},
|
|
1294
|
+
// Mixed V3_1 models
|
|
1295
|
+
"mixed-10-v3_1": {
|
|
1296
|
+
type: "mixed-10-v3_1",
|
|
1297
|
+
minFrames: 10,
|
|
1298
|
+
recommendedFrames: 10,
|
|
1299
|
+
description: "Mixed V3.1 10-frame model",
|
|
1300
|
+
deprecated: false,
|
|
1301
|
+
aliases: ["v3_1"]
|
|
1302
|
+
},
|
|
1303
|
+
"mixed-30-v3_1": {
|
|
1304
|
+
type: "mixed-30-v3_1",
|
|
1305
|
+
minFrames: 30,
|
|
1306
|
+
recommendedFrames: 30,
|
|
1307
|
+
description: "Mixed V3.1 30-frame model",
|
|
1308
|
+
deprecated: false,
|
|
1309
|
+
aliases: ["v3_1"]
|
|
1310
|
+
},
|
|
1311
|
+
"mixed-60-v3_1": {
|
|
1312
|
+
type: "mixed-60-v3_1",
|
|
1313
|
+
minFrames: 60,
|
|
1314
|
+
recommendedFrames: 60,
|
|
1315
|
+
description: "Mixed V3.1 60-frame model",
|
|
1316
|
+
deprecated: false,
|
|
1317
|
+
aliases: ["v3_1"]
|
|
1318
|
+
},
|
|
1319
|
+
"mixed-90-v3_1": {
|
|
1320
|
+
type: "mixed-90-v3_1",
|
|
1321
|
+
minFrames: 90,
|
|
1322
|
+
recommendedFrames: 90,
|
|
1323
|
+
description: "Mixed V3.1 90-frame model",
|
|
1324
|
+
deprecated: false,
|
|
1325
|
+
aliases: ["v3_1"]
|
|
1218
1326
|
}
|
|
1219
1327
|
};
|
|
1220
1328
|
var HYBRID_MODEL_CONFIGS = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moveris/shared",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Core business logic for Moveris Live SDK",
|
|
5
|
+
"author": "Moveris - Jeyson Palacio, Arthur ITurres, Eric D. Brown",
|
|
5
6
|
"main": "./dist/index.js",
|
|
6
7
|
"module": "./dist/index.mjs",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
@@ -21,7 +22,6 @@
|
|
|
21
22
|
"websocket",
|
|
22
23
|
"sdk"
|
|
23
24
|
],
|
|
24
|
-
"author": "Jeyson Palacio",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/jest": "^29.5.11",
|