@moveris/shared 3.9.0 → 3.11.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 +21 -21
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +19 -13
- package/dist/index.mjs +19 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -578,27 +578,27 @@ const status = getStatusMessage('capturing', DEFAULT_LOCALE);
|
|
|
578
578
|
|
|
579
579
|
#### Feedback Keys
|
|
580
580
|
|
|
581
|
-
| Key | English
|
|
582
|
-
| ------------------- |
|
|
583
|
-
| `no_face` | "No face detected"
|
|
584
|
-
| `face_not_centered` | "Center your face in the
|
|
585
|
-
| `too_close` | "Move back a little"
|
|
586
|
-
| `too_far` | "Move closer"
|
|
587
|
-
| `poor_lighting` | "Improve lighting"
|
|
588
|
-
| `hold_still` | "Hold still"
|
|
589
|
-
| `capturing` | "Capturing..."
|
|
590
|
-
| `processing` | "Processing..."
|
|
591
|
-
| `success` | "Verification complete"
|
|
592
|
-
| `failed` | "Verification failed"
|
|
593
|
-
| `eyes_not_visible` | "Eyes not clearly visible"
|
|
594
|
-
| `eyes_shadowed` | "Eyes are in shadow…"
|
|
595
|
-
| `eyes_overexposed` | "Eye region overexposed…"
|
|
596
|
-
| `glasses_glare` | "Glare detected…"
|
|
597
|
-
| `eye_quality_poor` | "Eye region quality is poor"
|
|
598
|
-
| `camera_angle_low` | "Raise camera to eye level"
|
|
599
|
-
| `camera_angle_high` | "Lower camera to eye level"
|
|
600
|
-
| `camera_tilted` | "Hold camera level"
|
|
601
|
-
| `flat_lighting` | "Find better lighting"
|
|
581
|
+
| Key | English | Description |
|
|
582
|
+
| ------------------- | -------------------------------- | --------------------------------------------------------------------------------- |
|
|
583
|
+
| `no_face` | "No face detected" | Face detection failed |
|
|
584
|
+
| `face_not_centered` | "Center your face in the circle" | Face outside guide |
|
|
585
|
+
| `too_close` | "Move back a little" | Face too close to camera |
|
|
586
|
+
| `too_far` | "Move closer" | Face too far from camera |
|
|
587
|
+
| `poor_lighting` | "Improve lighting" | Insufficient light |
|
|
588
|
+
| `hold_still` | "Hold still" | Movement detected |
|
|
589
|
+
| `capturing` | "Capturing..." | Frame capture in progress |
|
|
590
|
+
| `processing` | "Processing..." | API verification in progress |
|
|
591
|
+
| `success` | "Verification complete" | Successful completion |
|
|
592
|
+
| `failed` | "Verification failed" | Failed verification |
|
|
593
|
+
| `eyes_not_visible` | "Eyes not clearly visible" | Eye region featureless |
|
|
594
|
+
| `eyes_shadowed` | "Eyes are in shadow…" | Eye region too dark |
|
|
595
|
+
| `eyes_overexposed` | "Eye region overexposed…" | Eye region too bright |
|
|
596
|
+
| `glasses_glare` | "Glare detected…" | Specular highlights on eyes |
|
|
597
|
+
| `eye_quality_poor` | "Eye region quality is poor" | Generic eye quality failure |
|
|
598
|
+
| `camera_angle_low` | "Raise camera to eye level" | Camera below face (Y < 0.3) |
|
|
599
|
+
| `camera_angle_high` | "Lower camera to eye level" | Camera above face (Y > 0.7) |
|
|
600
|
+
| `camera_tilted` | "Hold camera level" | Device tilt > 15° (via transformation matrix, falls back to eye-corner landmarks) |
|
|
601
|
+
| `flat_lighting` | "Find better lighting" | Face-region dynamic range < 60 L-units — soft warning, capture continues |
|
|
602
602
|
|
|
603
603
|
---
|
|
604
604
|
|
package/dist/index.d.mts
CHANGED
|
@@ -26,6 +26,9 @@ type DeviceIntelligenceOverrides = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
type Verdict = 'live' | 'fake' | 'inconclusive';
|
|
29
|
+
type MetadataScalar = string | number | boolean | null;
|
|
30
|
+
type ExtraMetadataValue = MetadataScalar | Record<string, MetadataScalar>;
|
|
31
|
+
type ExtraMetadata = Record<string, ExtraMetadataValue>;
|
|
29
32
|
interface ConsumerContext {
|
|
30
33
|
url: string;
|
|
31
34
|
env: 'development' | 'staging' | 'production';
|
|
@@ -583,6 +586,7 @@ interface LivenessClientConfig {
|
|
|
583
586
|
deviceIntelligenceOverrides?: DeviceIntelligenceOverrides;
|
|
584
587
|
consumer?: ConsumerContext;
|
|
585
588
|
trackClientTime?: boolean;
|
|
589
|
+
extraMetadata?: ExtraMetadata;
|
|
586
590
|
}
|
|
587
591
|
declare class LivenessApiError extends Error {
|
|
588
592
|
readonly code: string;
|
|
@@ -605,12 +609,14 @@ declare class LivenessClient {
|
|
|
605
609
|
private readonly fetchFn;
|
|
606
610
|
private readonly consumer;
|
|
607
611
|
private readonly trackClientTime;
|
|
612
|
+
private readonly extraMetadata;
|
|
608
613
|
private diCollected;
|
|
609
614
|
private diCollecting;
|
|
610
615
|
private diOverrides;
|
|
611
616
|
constructor(config: LivenessClientConfig);
|
|
612
617
|
updateDeviceIntelligenceOverrides(partial: DeviceIntelligenceOverrides): void;
|
|
613
618
|
private getDeviceIntelligence;
|
|
619
|
+
private buildMetadata;
|
|
614
620
|
private applyDiOverrides;
|
|
615
621
|
private request;
|
|
616
622
|
private requestRaw;
|
|
@@ -843,7 +849,7 @@ declare const DEFAULT_STATUS_MESSAGES: {
|
|
|
843
849
|
};
|
|
844
850
|
type StatusMessageKey = keyof typeof DEFAULT_STATUS_MESSAGES;
|
|
845
851
|
declare const FEEDBACK_MESSAGES: {
|
|
846
|
-
readonly position_face: "Position your face in the
|
|
852
|
+
readonly position_face: "Position your face in the circle";
|
|
847
853
|
readonly no_face: "No face detected - move into frame";
|
|
848
854
|
readonly multiple_faces: "Multiple people detected - please verify alone";
|
|
849
855
|
readonly move_closer_to_center: "Move closer to center";
|
|
@@ -962,4 +968,4 @@ declare function collectDeviceIntelligence(opts?: {
|
|
|
962
968
|
platformVersion?: string;
|
|
963
969
|
}): Promise<DeviceIntelligence | null>;
|
|
964
970
|
|
|
965
|
-
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 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ type DeviceIntelligenceOverrides = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
type Verdict = 'live' | 'fake' | 'inconclusive';
|
|
29
|
+
type MetadataScalar = string | number | boolean | null;
|
|
30
|
+
type ExtraMetadataValue = MetadataScalar | Record<string, MetadataScalar>;
|
|
31
|
+
type ExtraMetadata = Record<string, ExtraMetadataValue>;
|
|
29
32
|
interface ConsumerContext {
|
|
30
33
|
url: string;
|
|
31
34
|
env: 'development' | 'staging' | 'production';
|
|
@@ -583,6 +586,7 @@ interface LivenessClientConfig {
|
|
|
583
586
|
deviceIntelligenceOverrides?: DeviceIntelligenceOverrides;
|
|
584
587
|
consumer?: ConsumerContext;
|
|
585
588
|
trackClientTime?: boolean;
|
|
589
|
+
extraMetadata?: ExtraMetadata;
|
|
586
590
|
}
|
|
587
591
|
declare class LivenessApiError extends Error {
|
|
588
592
|
readonly code: string;
|
|
@@ -605,12 +609,14 @@ declare class LivenessClient {
|
|
|
605
609
|
private readonly fetchFn;
|
|
606
610
|
private readonly consumer;
|
|
607
611
|
private readonly trackClientTime;
|
|
612
|
+
private readonly extraMetadata;
|
|
608
613
|
private diCollected;
|
|
609
614
|
private diCollecting;
|
|
610
615
|
private diOverrides;
|
|
611
616
|
constructor(config: LivenessClientConfig);
|
|
612
617
|
updateDeviceIntelligenceOverrides(partial: DeviceIntelligenceOverrides): void;
|
|
613
618
|
private getDeviceIntelligence;
|
|
619
|
+
private buildMetadata;
|
|
614
620
|
private applyDiOverrides;
|
|
615
621
|
private request;
|
|
616
622
|
private requestRaw;
|
|
@@ -843,7 +849,7 @@ declare const DEFAULT_STATUS_MESSAGES: {
|
|
|
843
849
|
};
|
|
844
850
|
type StatusMessageKey = keyof typeof DEFAULT_STATUS_MESSAGES;
|
|
845
851
|
declare const FEEDBACK_MESSAGES: {
|
|
846
|
-
readonly position_face: "Position your face in the
|
|
852
|
+
readonly position_face: "Position your face in the circle";
|
|
847
853
|
readonly no_face: "No face detected - move into frame";
|
|
848
854
|
readonly multiple_faces: "Multiple people detected - please verify alone";
|
|
849
855
|
readonly move_closer_to_center: "Move closer to center";
|
|
@@ -962,4 +968,4 @@ declare function collectDeviceIntelligence(opts?: {
|
|
|
962
968
|
platformVersion?: string;
|
|
963
969
|
}): Promise<DeviceIntelligence | null>;
|
|
964
970
|
|
|
965
|
-
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 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -239,7 +239,7 @@ async function sleep(ms) {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// package.json
|
|
242
|
-
var version = "3.
|
|
242
|
+
var version = "3.11.0";
|
|
243
243
|
|
|
244
244
|
// src/utils/deviceIntelligence.ts
|
|
245
245
|
var IPINFO_URL = "https://ipinfo.io/json";
|
|
@@ -389,6 +389,7 @@ var LivenessClient = class _LivenessClient {
|
|
|
389
389
|
this.diOverrides = { ...config.deviceIntelligenceOverrides };
|
|
390
390
|
this.consumer = config.consumer;
|
|
391
391
|
this.trackClientTime = config.trackClientTime ?? false;
|
|
392
|
+
this.extraMetadata = config.extraMetadata;
|
|
392
393
|
}
|
|
393
394
|
/**
|
|
394
395
|
* Merge additional device intelligence overrides into the existing set.
|
|
@@ -422,6 +423,13 @@ var LivenessClient = class _LivenessClient {
|
|
|
422
423
|
await this.diCollecting;
|
|
423
424
|
return this.diCollected ? this.applyDiOverrides(this.diCollected) : null;
|
|
424
425
|
}
|
|
426
|
+
buildMetadata() {
|
|
427
|
+
const meta = {
|
|
428
|
+
...this.consumer ? { consumer: this.consumer } : {},
|
|
429
|
+
...this.extraMetadata
|
|
430
|
+
};
|
|
431
|
+
return Object.keys(meta).length > 0 ? meta : void 0;
|
|
432
|
+
}
|
|
425
433
|
applyDiOverrides(collected) {
|
|
426
434
|
const ov = this.diOverrides;
|
|
427
435
|
return {
|
|
@@ -677,7 +685,7 @@ var LivenessClient = class _LivenessClient {
|
|
|
677
685
|
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
678
686
|
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
679
687
|
...di ? { device_intelligence: di } : {},
|
|
680
|
-
...this.
|
|
688
|
+
...this.buildMetadata() ? { metadata: this.buildMetadata() } : {}
|
|
681
689
|
};
|
|
682
690
|
const { data: response, headers } = await this.requestWithRetryRaw(
|
|
683
691
|
API_PATHS.fastCheck,
|
|
@@ -715,7 +723,7 @@ var LivenessClient = class _LivenessClient {
|
|
|
715
723
|
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
716
724
|
...options.bgSegmentation !== void 0 ? { bg_segmentation: options.bgSegmentation } : {},
|
|
717
725
|
...di ? { device_intelligence: di } : {},
|
|
718
|
-
...this.
|
|
726
|
+
...this.buildMetadata() ? { metadata: this.buildMetadata() } : {}
|
|
719
727
|
};
|
|
720
728
|
const { data: response, headers } = await this.requestWithRetryRaw(
|
|
721
729
|
API_PATHS.fastCheckCrops,
|
|
@@ -780,7 +788,7 @@ var LivenessClient = class _LivenessClient {
|
|
|
780
788
|
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
781
789
|
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
782
790
|
...di ? { device_intelligence: di } : {},
|
|
783
|
-
...this.
|
|
791
|
+
...this.buildMetadata() ? { metadata: this.buildMetadata() } : {}
|
|
784
792
|
};
|
|
785
793
|
return this.requestWithRetry(API_PATHS.fastCheckStream, {
|
|
786
794
|
method: "POST",
|
|
@@ -1529,7 +1537,7 @@ var DEFAULT_STATUS_MESSAGES = {
|
|
|
1529
1537
|
};
|
|
1530
1538
|
var FEEDBACK_MESSAGES = {
|
|
1531
1539
|
// Initial / No face (Red state)
|
|
1532
|
-
position_face: "Position your face in the
|
|
1540
|
+
position_face: "Position your face in the circle",
|
|
1533
1541
|
no_face: "No face detected - move into frame",
|
|
1534
1542
|
multiple_faces: "Multiple people detected - please verify alone",
|
|
1535
1543
|
// Poor alignment (Orange state) - alignment < 50%
|
|
@@ -1593,7 +1601,7 @@ var ES_LOCALE = {
|
|
|
1593
1601
|
},
|
|
1594
1602
|
feedback: {
|
|
1595
1603
|
// Initial / No face (Red state)
|
|
1596
|
-
position_face: "Posiciona tu rostro en el \
|
|
1604
|
+
position_face: "Posiciona tu rostro en el c\xEDrculo",
|
|
1597
1605
|
no_face: "No se detecta rostro - mu\xE9vete al marco",
|
|
1598
1606
|
multiple_faces: "Varias personas detectadas - verifica solo",
|
|
1599
1607
|
// Poor alignment (Orange state)
|
|
@@ -1931,16 +1939,14 @@ function isFaceFullyVisible(boundingBox, frameWidth, frameHeight) {
|
|
|
1931
1939
|
var OVAL_REGION_DESKTOP = {
|
|
1932
1940
|
centerX: 0.5,
|
|
1933
1941
|
centerY: 0.5,
|
|
1934
|
-
width: 0.
|
|
1935
|
-
height: 0.
|
|
1936
|
-
// 0.36 * (4/3)
|
|
1942
|
+
width: 0.45,
|
|
1943
|
+
height: 0.45
|
|
1937
1944
|
};
|
|
1938
1945
|
var OVAL_REGION_MOBILE = {
|
|
1939
1946
|
centerX: 0.5,
|
|
1940
1947
|
centerY: 0.5,
|
|
1941
|
-
width: 0.
|
|
1942
|
-
height: 0.
|
|
1943
|
-
// 0.48 * (4/3)
|
|
1948
|
+
width: 0.62,
|
|
1949
|
+
height: 0.62
|
|
1944
1950
|
};
|
|
1945
1951
|
var DEFAULT_OVAL_REGION = OVAL_REGION_DESKTOP;
|
|
1946
1952
|
function isFaceInOval(faceBox, frameWidth, frameHeight, oval = DEFAULT_OVAL_REGION, tolerance = 0.3) {
|
|
@@ -1972,7 +1978,7 @@ function isFaceInOval(faceBox, frameWidth, frameHeight, oval = DEFAULT_OVAL_REGI
|
|
|
1972
1978
|
} else if (dx > 0.1) {
|
|
1973
1979
|
feedback = "Move face left";
|
|
1974
1980
|
} else {
|
|
1975
|
-
feedback = "Center your face in the
|
|
1981
|
+
feedback = "Center your face in the circle";
|
|
1976
1982
|
}
|
|
1977
1983
|
} else if (tooSmall) {
|
|
1978
1984
|
feedback = "Move closer";
|
package/dist/index.mjs
CHANGED
|
@@ -97,7 +97,7 @@ async function sleep(ms) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// package.json
|
|
100
|
-
var version = "3.
|
|
100
|
+
var version = "3.11.0";
|
|
101
101
|
|
|
102
102
|
// src/utils/deviceIntelligence.ts
|
|
103
103
|
var IPINFO_URL = "https://ipinfo.io/json";
|
|
@@ -247,6 +247,7 @@ var LivenessClient = class _LivenessClient {
|
|
|
247
247
|
this.diOverrides = { ...config.deviceIntelligenceOverrides };
|
|
248
248
|
this.consumer = config.consumer;
|
|
249
249
|
this.trackClientTime = config.trackClientTime ?? false;
|
|
250
|
+
this.extraMetadata = config.extraMetadata;
|
|
250
251
|
}
|
|
251
252
|
/**
|
|
252
253
|
* Merge additional device intelligence overrides into the existing set.
|
|
@@ -280,6 +281,13 @@ var LivenessClient = class _LivenessClient {
|
|
|
280
281
|
await this.diCollecting;
|
|
281
282
|
return this.diCollected ? this.applyDiOverrides(this.diCollected) : null;
|
|
282
283
|
}
|
|
284
|
+
buildMetadata() {
|
|
285
|
+
const meta = {
|
|
286
|
+
...this.consumer ? { consumer: this.consumer } : {},
|
|
287
|
+
...this.extraMetadata
|
|
288
|
+
};
|
|
289
|
+
return Object.keys(meta).length > 0 ? meta : void 0;
|
|
290
|
+
}
|
|
283
291
|
applyDiOverrides(collected) {
|
|
284
292
|
const ov = this.diOverrides;
|
|
285
293
|
return {
|
|
@@ -535,7 +543,7 @@ var LivenessClient = class _LivenessClient {
|
|
|
535
543
|
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
536
544
|
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
537
545
|
...di ? { device_intelligence: di } : {},
|
|
538
|
-
...this.
|
|
546
|
+
...this.buildMetadata() ? { metadata: this.buildMetadata() } : {}
|
|
539
547
|
};
|
|
540
548
|
const { data: response, headers } = await this.requestWithRetryRaw(
|
|
541
549
|
API_PATHS.fastCheck,
|
|
@@ -573,7 +581,7 @@ var LivenessClient = class _LivenessClient {
|
|
|
573
581
|
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
574
582
|
...options.bgSegmentation !== void 0 ? { bg_segmentation: options.bgSegmentation } : {},
|
|
575
583
|
...di ? { device_intelligence: di } : {},
|
|
576
|
-
...this.
|
|
584
|
+
...this.buildMetadata() ? { metadata: this.buildMetadata() } : {}
|
|
577
585
|
};
|
|
578
586
|
const { data: response, headers } = await this.requestWithRetryRaw(
|
|
579
587
|
API_PATHS.fastCheckCrops,
|
|
@@ -638,7 +646,7 @@ var LivenessClient = class _LivenessClient {
|
|
|
638
646
|
...options.frameCount != null ? { frame_count: options.frameCount } : {},
|
|
639
647
|
...options.warnings?.length ? { warnings: options.warnings } : {},
|
|
640
648
|
...di ? { device_intelligence: di } : {},
|
|
641
|
-
...this.
|
|
649
|
+
...this.buildMetadata() ? { metadata: this.buildMetadata() } : {}
|
|
642
650
|
};
|
|
643
651
|
return this.requestWithRetry(API_PATHS.fastCheckStream, {
|
|
644
652
|
method: "POST",
|
|
@@ -1387,7 +1395,7 @@ var DEFAULT_STATUS_MESSAGES = {
|
|
|
1387
1395
|
};
|
|
1388
1396
|
var FEEDBACK_MESSAGES = {
|
|
1389
1397
|
// Initial / No face (Red state)
|
|
1390
|
-
position_face: "Position your face in the
|
|
1398
|
+
position_face: "Position your face in the circle",
|
|
1391
1399
|
no_face: "No face detected - move into frame",
|
|
1392
1400
|
multiple_faces: "Multiple people detected - please verify alone",
|
|
1393
1401
|
// Poor alignment (Orange state) - alignment < 50%
|
|
@@ -1451,7 +1459,7 @@ var ES_LOCALE = {
|
|
|
1451
1459
|
},
|
|
1452
1460
|
feedback: {
|
|
1453
1461
|
// Initial / No face (Red state)
|
|
1454
|
-
position_face: "Posiciona tu rostro en el \
|
|
1462
|
+
position_face: "Posiciona tu rostro en el c\xEDrculo",
|
|
1455
1463
|
no_face: "No se detecta rostro - mu\xE9vete al marco",
|
|
1456
1464
|
multiple_faces: "Varias personas detectadas - verifica solo",
|
|
1457
1465
|
// Poor alignment (Orange state)
|
|
@@ -1789,16 +1797,14 @@ function isFaceFullyVisible(boundingBox, frameWidth, frameHeight) {
|
|
|
1789
1797
|
var OVAL_REGION_DESKTOP = {
|
|
1790
1798
|
centerX: 0.5,
|
|
1791
1799
|
centerY: 0.5,
|
|
1792
|
-
width: 0.
|
|
1793
|
-
height: 0.
|
|
1794
|
-
// 0.36 * (4/3)
|
|
1800
|
+
width: 0.45,
|
|
1801
|
+
height: 0.45
|
|
1795
1802
|
};
|
|
1796
1803
|
var OVAL_REGION_MOBILE = {
|
|
1797
1804
|
centerX: 0.5,
|
|
1798
1805
|
centerY: 0.5,
|
|
1799
|
-
width: 0.
|
|
1800
|
-
height: 0.
|
|
1801
|
-
// 0.48 * (4/3)
|
|
1806
|
+
width: 0.62,
|
|
1807
|
+
height: 0.62
|
|
1802
1808
|
};
|
|
1803
1809
|
var DEFAULT_OVAL_REGION = OVAL_REGION_DESKTOP;
|
|
1804
1810
|
function isFaceInOval(faceBox, frameWidth, frameHeight, oval = DEFAULT_OVAL_REGION, tolerance = 0.3) {
|
|
@@ -1830,7 +1836,7 @@ function isFaceInOval(faceBox, frameWidth, frameHeight, oval = DEFAULT_OVAL_REGI
|
|
|
1830
1836
|
} else if (dx > 0.1) {
|
|
1831
1837
|
feedback = "Move face left";
|
|
1832
1838
|
} else {
|
|
1833
|
-
feedback = "Center your face in the
|
|
1839
|
+
feedback = "Center your face in the circle";
|
|
1834
1840
|
}
|
|
1835
1841
|
} else if (tooSmall) {
|
|
1836
1842
|
feedback = "Move closer";
|