@moveris/shared 1.0.2 → 2.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/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  type Verdict = 'live' | 'fake';
2
- type FastCheckModel = '10' | '50' | '250';
2
+ 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';
3
+ type StreamingStatus = 'buffering' | 'complete';
3
4
  type FrameSource = 'media' | 'live';
4
5
  type JobStatus = 'queued' | 'processing' | 'complete' | 'failed';
5
6
  interface FrameData {
@@ -50,6 +51,12 @@ interface Hybrid150CheckRequest {
50
51
  fps?: number;
51
52
  frames: HybridFrameData[];
52
53
  }
54
+ interface FastCheckStreamRequest {
55
+ session_id: string;
56
+ model?: FastCheckModel;
57
+ source?: FrameSource;
58
+ frame: FrameData;
59
+ }
53
60
  interface FastCheckResponse {
54
61
  verdict: Verdict | null;
55
62
  confidence: number | null;
@@ -63,6 +70,23 @@ interface FastCheckResponse {
63
70
  warning: string | null;
64
71
  error: string | null;
65
72
  }
73
+ interface FastCheckStreamResponse {
74
+ status: StreamingStatus;
75
+ session_id: string;
76
+ frames_received: number;
77
+ frames_required: number;
78
+ ttl_seconds: number;
79
+ verdict: Verdict | null;
80
+ confidence: number | null;
81
+ real_score: number | null;
82
+ score: number | null;
83
+ model: string | null;
84
+ processing_ms: number | null;
85
+ frames_processed: number | null;
86
+ available: boolean;
87
+ warning: string | null;
88
+ error: string | null;
89
+ }
66
90
  interface VerifyResponse {
67
91
  verdict: Verdict;
68
92
  confidence: number;
@@ -197,6 +221,7 @@ declare class LivenessApiError extends Error {
197
221
  declare function toFrameData(frames: CapturedFrame[]): FrameData[];
198
222
  declare function toHybridFrameData(frames: CapturedFrame[]): HybridFrameData[];
199
223
  declare function toLivenessResult(response: FastCheckResponse | VerifyResponse | HybridCheckResponse): LivenessResult;
224
+ declare function toLivenessResultFromStream(response: FastCheckStreamResponse): LivenessResult;
200
225
  declare function generateSessionId(): string;
201
226
  declare class LivenessClient {
202
227
  private readonly baseUrl;
@@ -219,6 +244,23 @@ declare class LivenessClient {
219
244
  model?: FastCheckModel;
220
245
  source?: FrameSource;
221
246
  }): Promise<LivenessResult>;
247
+ private sendStreamFrame;
248
+ fastCheckStream(frames: CapturedFrame[], options?: {
249
+ sessionId?: string;
250
+ model?: FastCheckModel;
251
+ source?: FrameSource;
252
+ }, callbacks?: {
253
+ onFrameSent?: (index: number, total: number) => void;
254
+ onFrameBuffered?: (framesReceived: number, framesRequired: number) => void;
255
+ }): Promise<LivenessResult>;
256
+ fastCheckStreamSequential(frames: CapturedFrame[], options?: {
257
+ sessionId?: string;
258
+ model?: FastCheckModel;
259
+ source?: FrameSource;
260
+ }, callbacks?: {
261
+ onFrameSent?: (index: number, total: number) => void;
262
+ onFrameBuffered?: (framesReceived: number, framesRequired: number) => void;
263
+ }): Promise<LivenessResult>;
222
264
  verify(frames: CapturedFrame[], options?: {
223
265
  sessionId?: string;
224
266
  captureStartMs?: number;
@@ -284,6 +326,7 @@ declare const API_PATHS: {
284
326
  readonly health: "/health";
285
327
  readonly fastCheck: "/api/v1/fast-check";
286
328
  readonly fastCheckCrops: "/api/v1/fast-check-crops";
329
+ readonly fastCheckStream: "/api/v1/fast-check-stream";
287
330
  readonly verify: "/api/v1/verify";
288
331
  readonly hybridCheck: "/api/v1/hybrid-check";
289
332
  readonly hybrid50: "/api/v1/hybrid-50";
@@ -541,4 +584,4 @@ declare class BaseFrameCollector {
541
584
  getNextIndex(): number;
542
585
  }
543
586
 
544
- export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_PATHS, AUTH_CONFIG, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STATUS_MESSAGES, ES_LOCALE, type ErrorResponse, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceInOvalResult, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LOW_LIGHT_THRESHOLD, 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, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MODEL_CONFIGS, type ModelConfig, type ModelType, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StatusMessageKey, TARGET_FACE_PERCENTAGE_IN_CROP, type Verdict, type VerifyRequest, type VerifyResponse, analyzeBlur, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkFrameQuality, decodeBase64, encodeBase64, generateSessionId, getCaptureQualityFeedback, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, validateApiKey, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
587
+ export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_PATHS, AUTH_CONFIG, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STATUS_MESSAGES, ES_LOCALE, type ErrorResponse, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceInOvalResult, 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, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LOW_LIGHT_THRESHOLD, 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, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MODEL_CONFIGS, type ModelConfig, type ModelType, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, type Verdict, type VerifyRequest, type VerifyResponse, analyzeBlur, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkFrameQuality, decodeBase64, encodeBase64, generateSessionId, getCaptureQualityFeedback, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  type Verdict = 'live' | 'fake';
2
- type FastCheckModel = '10' | '50' | '250';
2
+ 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';
3
+ type StreamingStatus = 'buffering' | 'complete';
3
4
  type FrameSource = 'media' | 'live';
4
5
  type JobStatus = 'queued' | 'processing' | 'complete' | 'failed';
5
6
  interface FrameData {
@@ -50,6 +51,12 @@ interface Hybrid150CheckRequest {
50
51
  fps?: number;
51
52
  frames: HybridFrameData[];
52
53
  }
54
+ interface FastCheckStreamRequest {
55
+ session_id: string;
56
+ model?: FastCheckModel;
57
+ source?: FrameSource;
58
+ frame: FrameData;
59
+ }
53
60
  interface FastCheckResponse {
54
61
  verdict: Verdict | null;
55
62
  confidence: number | null;
@@ -63,6 +70,23 @@ interface FastCheckResponse {
63
70
  warning: string | null;
64
71
  error: string | null;
65
72
  }
73
+ interface FastCheckStreamResponse {
74
+ status: StreamingStatus;
75
+ session_id: string;
76
+ frames_received: number;
77
+ frames_required: number;
78
+ ttl_seconds: number;
79
+ verdict: Verdict | null;
80
+ confidence: number | null;
81
+ real_score: number | null;
82
+ score: number | null;
83
+ model: string | null;
84
+ processing_ms: number | null;
85
+ frames_processed: number | null;
86
+ available: boolean;
87
+ warning: string | null;
88
+ error: string | null;
89
+ }
66
90
  interface VerifyResponse {
67
91
  verdict: Verdict;
68
92
  confidence: number;
@@ -197,6 +221,7 @@ declare class LivenessApiError extends Error {
197
221
  declare function toFrameData(frames: CapturedFrame[]): FrameData[];
198
222
  declare function toHybridFrameData(frames: CapturedFrame[]): HybridFrameData[];
199
223
  declare function toLivenessResult(response: FastCheckResponse | VerifyResponse | HybridCheckResponse): LivenessResult;
224
+ declare function toLivenessResultFromStream(response: FastCheckStreamResponse): LivenessResult;
200
225
  declare function generateSessionId(): string;
201
226
  declare class LivenessClient {
202
227
  private readonly baseUrl;
@@ -219,6 +244,23 @@ declare class LivenessClient {
219
244
  model?: FastCheckModel;
220
245
  source?: FrameSource;
221
246
  }): Promise<LivenessResult>;
247
+ private sendStreamFrame;
248
+ fastCheckStream(frames: CapturedFrame[], options?: {
249
+ sessionId?: string;
250
+ model?: FastCheckModel;
251
+ source?: FrameSource;
252
+ }, callbacks?: {
253
+ onFrameSent?: (index: number, total: number) => void;
254
+ onFrameBuffered?: (framesReceived: number, framesRequired: number) => void;
255
+ }): Promise<LivenessResult>;
256
+ fastCheckStreamSequential(frames: CapturedFrame[], options?: {
257
+ sessionId?: string;
258
+ model?: FastCheckModel;
259
+ source?: FrameSource;
260
+ }, callbacks?: {
261
+ onFrameSent?: (index: number, total: number) => void;
262
+ onFrameBuffered?: (framesReceived: number, framesRequired: number) => void;
263
+ }): Promise<LivenessResult>;
222
264
  verify(frames: CapturedFrame[], options?: {
223
265
  sessionId?: string;
224
266
  captureStartMs?: number;
@@ -284,6 +326,7 @@ declare const API_PATHS: {
284
326
  readonly health: "/health";
285
327
  readonly fastCheck: "/api/v1/fast-check";
286
328
  readonly fastCheckCrops: "/api/v1/fast-check-crops";
329
+ readonly fastCheckStream: "/api/v1/fast-check-stream";
287
330
  readonly verify: "/api/v1/verify";
288
331
  readonly hybridCheck: "/api/v1/hybrid-check";
289
332
  readonly hybrid50: "/api/v1/hybrid-50";
@@ -541,4 +584,4 @@ declare class BaseFrameCollector {
541
584
  getNextIndex(): number;
542
585
  }
543
586
 
544
- export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_PATHS, AUTH_CONFIG, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STATUS_MESSAGES, ES_LOCALE, type ErrorResponse, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceInOvalResult, type FaceVisibilityResult, type FastCheckCropsRequest, type FastCheckModel, type FastCheckRequest, type FastCheckResponse, type FeedbackLocale, type FeedbackMessageKey, type Frame, FrameBuffer, type FrameData, type FrameQualityResult, FrameQueue, type FrameSource, GOOD_ALIGNMENT, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LOW_LIGHT_THRESHOLD, 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, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MODEL_CONFIGS, type ModelConfig, type ModelType, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StatusMessageKey, TARGET_FACE_PERCENTAGE_IN_CROP, type Verdict, type VerifyRequest, type VerifyResponse, analyzeBlur, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkFrameQuality, decodeBase64, encodeBase64, generateSessionId, getCaptureQualityFeedback, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, validateApiKey, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
587
+ export { ALIGNMENT_THRESHOLD_CAPTURE, ALIGNMENT_THRESHOLD_GOOD, ALIGNMENT_THRESHOLD_PERFECT, ALIGNMENT_THRESHOLD_POOR, API_ENDPOINTS, API_PATHS, AUTH_CONFIG, BACKLIT_RATIO_THRESHOLD, BLUR_THRESHOLD_MOBILE, BaseFrameCollector, type BlurAnalysis, type CaptureQualityState, type CapturedFrame, type CropData, DEFAULT_BLUR_THRESHOLD, DEFAULT_ENDPOINT, DEFAULT_LIVENESS_CONFIG, DEFAULT_LOCALE, DEFAULT_OVAL_REGION, DEFAULT_STATUS_MESSAGES, ES_LOCALE, type ErrorResponse, FACE_CENTER_VERTICAL_OFFSET, FACE_CROP_OUTPUT_SIZE, FEEDBACK_MESSAGES, FRAME_BUFFER_CONFIG, FRAME_CONFIG, type FaceAlignmentResult, type FaceBoundingBox, type FaceInOvalResult, 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, HIGH_ALIGNMENT, HYBRID_MODEL_CONFIGS, type HealthResponse, type Hybrid150CheckRequest, type Hybrid50CheckRequest, type HybridCheckRequest, type HybridCheckResponse, type HybridFrameData, type HybridModelConfig, IDEAL_CROP_MULTIPLIER, type JobStatus, type JobStatusResponse, LOW_LIGHT_THRESHOLD, 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, MIN_CAPTURE_ALIGNMENT, MIN_CROP_MULTIPLIER, MIN_FACE_BOTTOM_MARGIN, MIN_FACE_RATIO, MIN_FACE_SIDE_MARGIN, MIN_FACE_TOP_MARGIN, MODEL_CONFIGS, type ModelConfig, type ModelType, OVAL_GUIDE_COLORS, OVAL_GUIDE_STYLES, type OnErrorCallback, type OnFrameCapturedCallback, type OnProgressCallback, type OnResultCallback, type OnStateChangeCallback, type OvalGuideState, type OvalRegion, type QueueStatsResponse, RETRY_CONFIG, type RetryOptions, type StatusMessageKey, type StreamingStatus, TARGET_FACE_PERCENTAGE_IN_CROP, type Verdict, type VerifyRequest, type VerifyResponse, analyzeBlur, analyzeLighting, calculateAdaptiveCropMultiplier, calculateBrightness, calculateFaceAlignment, calculateFaceCropRegion, canCaptureFrame, checkFrameQuality, decodeBase64, encodeBase64, generateSessionId, getCaptureQualityFeedback, getFeedbackMessage, getMinFramesForModel, getOvalGuideState, getStatusMessage, hasEnoughFrames, isFaceCropFullyInFrame, isFaceFullyVisible, isFaceInOval, retryWithBackoff, rgbaToGrayscale, sleep, toFrameData, toHybridFrameData, toLivenessResult, toLivenessResultFromStream, validateApiKey, validateFrameCount, validateFrameData, validateFrameIndex, validateTimestamp, validateUUID, validateUrl };
package/dist/index.js CHANGED
@@ -91,6 +91,7 @@ __export(index_exports, {
91
91
  toFrameData: () => toFrameData,
92
92
  toHybridFrameData: () => toHybridFrameData,
93
93
  toLivenessResult: () => toLivenessResult,
94
+ toLivenessResultFromStream: () => toLivenessResultFromStream,
94
95
  validateApiKey: () => validateApiKey,
95
96
  validateFrameCount: () => validateFrameCount,
96
97
  validateFrameData: () => validateFrameData,
@@ -112,6 +113,7 @@ var API_PATHS = {
112
113
  health: "/health",
113
114
  fastCheck: "/api/v1/fast-check",
114
115
  fastCheckCrops: "/api/v1/fast-check-crops",
116
+ fastCheckStream: "/api/v1/fast-check-stream",
115
117
  verify: "/api/v1/verify",
116
118
  hybridCheck: "/api/v1/hybrid-check",
117
119
  hybrid50: "/api/v1/hybrid-50",
@@ -232,6 +234,22 @@ function toLivenessResult(response) {
232
234
  framesProcessed: "frames_processed" in response ? response.frames_processed ?? 0 : 0
233
235
  };
234
236
  }
237
+ function toLivenessResultFromStream(response) {
238
+ if (response.status !== "complete") {
239
+ throw new LivenessApiError("Stream not complete", "stream_incomplete", 400);
240
+ }
241
+ if (!response.verdict) {
242
+ throw new LivenessApiError(response.error ?? "No verdict received", "no_verdict", 500);
243
+ }
244
+ return {
245
+ verdict: response.verdict,
246
+ confidence: response.confidence ?? 0,
247
+ score: response.score ?? 0,
248
+ sessionId: response.session_id,
249
+ processingMs: response.processing_ms ?? 0,
250
+ framesProcessed: response.frames_processed ?? 0
251
+ };
252
+ }
235
253
  function generateSessionId() {
236
254
  if (typeof crypto !== "undefined" && crypto.randomUUID) {
237
255
  return crypto.randomUUID();
@@ -366,6 +384,116 @@ var LivenessClient = class {
366
384
  });
367
385
  return toLivenessResult(response);
368
386
  }
387
+ /**
388
+ * Send a single frame to the streaming endpoint with retry
389
+ *
390
+ * @param frame - Single frame to send
391
+ * @param options - Session and model options
392
+ * @returns Stream response with status
393
+ */
394
+ async sendStreamFrame(frame, options) {
395
+ const request = {
396
+ session_id: options.sessionId,
397
+ model: options.model,
398
+ source: options.source,
399
+ frame
400
+ };
401
+ return this.requestWithRetry(API_PATHS.fastCheckStream, {
402
+ method: "POST",
403
+ body: JSON.stringify(request)
404
+ });
405
+ }
406
+ /**
407
+ * Perform streaming liveness check by sending frames one at a time
408
+ *
409
+ * Each frame is sent separately to the streaming endpoint with individual retry.
410
+ * The last frame that completes the set will return the full liveness result.
411
+ *
412
+ * @param frames - Captured frames to analyze
413
+ * @param options - Additional options
414
+ * @param callbacks - Optional callbacks for progress tracking
415
+ * @returns Liveness result
416
+ */
417
+ async fastCheckStream(frames, options = {}, callbacks) {
418
+ const sessionId = options.sessionId ?? generateSessionId();
419
+ const model = options.model ?? "10";
420
+ const source = options.source ?? "live";
421
+ const frameDataList = toFrameData(frames);
422
+ const total = frameDataList.length;
423
+ let finalResponse = null;
424
+ const sendPromises = frameDataList.map(async (frameData, index) => {
425
+ const response = await this.sendStreamFrame(frameData, {
426
+ sessionId,
427
+ model,
428
+ source
429
+ });
430
+ callbacks?.onFrameSent?.(index + 1, total);
431
+ if (response.status === "buffering") {
432
+ callbacks?.onFrameBuffered?.(response.frames_received, response.frames_required);
433
+ }
434
+ return response;
435
+ });
436
+ const responses = await Promise.all(sendPromises);
437
+ finalResponse = responses.find((r) => r.status === "complete") ?? null;
438
+ if (!finalResponse) {
439
+ const lastResponse = responses[responses.length - 1];
440
+ if (lastResponse) {
441
+ throw new LivenessApiError(
442
+ `Streaming incomplete: received ${lastResponse.frames_received}/${lastResponse.frames_required} frames`,
443
+ "stream_incomplete",
444
+ 400
445
+ );
446
+ }
447
+ throw new LivenessApiError(
448
+ "Streaming failed: no responses received",
449
+ "stream_incomplete",
450
+ 400
451
+ );
452
+ }
453
+ return toLivenessResultFromStream(finalResponse);
454
+ }
455
+ /**
456
+ * Perform streaming liveness check by sending frames sequentially
457
+ *
458
+ * Alternative to fastCheckStream that sends frames one by one in order.
459
+ * Useful when parallel uploads are not desired or network is constrained.
460
+ *
461
+ * @param frames - Captured frames to analyze
462
+ * @param options - Additional options
463
+ * @param callbacks - Optional callbacks for progress tracking
464
+ * @returns Liveness result
465
+ */
466
+ async fastCheckStreamSequential(frames, options = {}, callbacks) {
467
+ const sessionId = options.sessionId ?? generateSessionId();
468
+ const model = options.model ?? "10";
469
+ const source = options.source ?? "live";
470
+ const frameDataList = toFrameData(frames);
471
+ const total = frameDataList.length;
472
+ let finalResponse = null;
473
+ for (const frameData of frameDataList) {
474
+ const response = await this.sendStreamFrame(frameData, {
475
+ sessionId,
476
+ model,
477
+ source
478
+ });
479
+ const currentIndex = frameData.index;
480
+ callbacks?.onFrameSent?.(currentIndex + 1, total);
481
+ if (response.status === "buffering") {
482
+ callbacks?.onFrameBuffered?.(response.frames_received, response.frames_required);
483
+ } else if (response.status === "complete") {
484
+ finalResponse = response;
485
+ break;
486
+ }
487
+ }
488
+ if (!finalResponse) {
489
+ throw new LivenessApiError(
490
+ "Streaming did not complete after all frames sent",
491
+ "stream_incomplete",
492
+ 400
493
+ );
494
+ }
495
+ return toLivenessResultFromStream(finalResponse);
496
+ }
369
497
  // ===========================================================================
370
498
  // Verify Endpoint (Spatial Features)
371
499
  // ===========================================================================
@@ -622,6 +750,7 @@ var FrameQueue = class {
622
750
 
623
751
  // src/types/models.ts
624
752
  var MODEL_CONFIGS = {
753
+ // Standard fast-check models
625
754
  "10": {
626
755
  type: "10",
627
756
  minFrames: 10,
@@ -639,6 +768,104 @@ var MODEL_CONFIGS = {
639
768
  minFrames: 250,
640
769
  recommendedFrames: 250,
641
770
  description: "High-accuracy model - 250 frames, best accuracy"
771
+ },
772
+ // Hybrid V2 models with physiological features
773
+ "hybrid-v2-10": {
774
+ type: "hybrid-v2-10",
775
+ minFrames: 10,
776
+ recommendedFrames: 10,
777
+ description: "Hybrid V2 10-frame model with physio features"
778
+ },
779
+ "hybrid-v2-30": {
780
+ type: "hybrid-v2-30",
781
+ minFrames: 30,
782
+ recommendedFrames: 30,
783
+ description: "Hybrid V2 30-frame model with physio features"
784
+ },
785
+ "hybrid-v2-50": {
786
+ type: "hybrid-v2-50",
787
+ minFrames: 50,
788
+ recommendedFrames: 50,
789
+ description: "Hybrid V2 50-frame model with physio features"
790
+ },
791
+ "hybrid-v2-60": {
792
+ type: "hybrid-v2-60",
793
+ minFrames: 60,
794
+ recommendedFrames: 60,
795
+ description: "Hybrid V2 60-frame model with physio features"
796
+ },
797
+ "hybrid-v2-90": {
798
+ type: "hybrid-v2-90",
799
+ minFrames: 90,
800
+ recommendedFrames: 90,
801
+ description: "Hybrid V2 90-frame model with physio features"
802
+ },
803
+ "hybrid-v2-100": {
804
+ type: "hybrid-v2-100",
805
+ minFrames: 100,
806
+ recommendedFrames: 100,
807
+ description: "Hybrid V2 100-frame model with physio features"
808
+ },
809
+ "hybrid-v2-125": {
810
+ type: "hybrid-v2-125",
811
+ minFrames: 125,
812
+ recommendedFrames: 125,
813
+ description: "Hybrid V2 125-frame model with physio features"
814
+ },
815
+ "hybrid-v2-150": {
816
+ type: "hybrid-v2-150",
817
+ minFrames: 150,
818
+ recommendedFrames: 150,
819
+ description: "Hybrid V2 150-frame model with physio features"
820
+ },
821
+ "hybrid-v2-250": {
822
+ type: "hybrid-v2-250",
823
+ minFrames: 250,
824
+ recommendedFrames: 250,
825
+ description: "Hybrid V2 250-frame model with physio features"
826
+ },
827
+ // Mixed models (FastLivenessDetector with mixed-trained weights)
828
+ "mixed-10": {
829
+ type: "mixed-10",
830
+ minFrames: 10,
831
+ recommendedFrames: 10,
832
+ description: "Mixed 10-frame model"
833
+ },
834
+ "mixed-30": {
835
+ type: "mixed-30",
836
+ minFrames: 30,
837
+ recommendedFrames: 30,
838
+ description: "Mixed 30-frame model"
839
+ },
840
+ "mixed-60": {
841
+ type: "mixed-60",
842
+ minFrames: 60,
843
+ recommendedFrames: 60,
844
+ description: "Mixed 60-frame model"
845
+ },
846
+ "mixed-90": {
847
+ type: "mixed-90",
848
+ minFrames: 90,
849
+ recommendedFrames: 90,
850
+ description: "Mixed 90-frame model"
851
+ },
852
+ "mixed-120": {
853
+ type: "mixed-120",
854
+ minFrames: 120,
855
+ recommendedFrames: 120,
856
+ description: "Mixed 120-frame model"
857
+ },
858
+ "mixed-150": {
859
+ type: "mixed-150",
860
+ minFrames: 150,
861
+ recommendedFrames: 150,
862
+ description: "Mixed 150-frame model"
863
+ },
864
+ "mixed-250": {
865
+ type: "mixed-250",
866
+ minFrames: 250,
867
+ recommendedFrames: 250,
868
+ description: "Mixed 250-frame model"
642
869
  }
643
870
  };
644
871
  var HYBRID_MODEL_CONFIGS = {
@@ -1277,6 +1504,7 @@ var BaseFrameCollector = class {
1277
1504
  toFrameData,
1278
1505
  toHybridFrameData,
1279
1506
  toLivenessResult,
1507
+ toLivenessResultFromStream,
1280
1508
  validateApiKey,
1281
1509
  validateFrameCount,
1282
1510
  validateFrameData,
package/dist/index.mjs CHANGED
@@ -9,6 +9,7 @@ var API_PATHS = {
9
9
  health: "/health",
10
10
  fastCheck: "/api/v1/fast-check",
11
11
  fastCheckCrops: "/api/v1/fast-check-crops",
12
+ fastCheckStream: "/api/v1/fast-check-stream",
12
13
  verify: "/api/v1/verify",
13
14
  hybridCheck: "/api/v1/hybrid-check",
14
15
  hybrid50: "/api/v1/hybrid-50",
@@ -129,6 +130,22 @@ function toLivenessResult(response) {
129
130
  framesProcessed: "frames_processed" in response ? response.frames_processed ?? 0 : 0
130
131
  };
131
132
  }
133
+ function toLivenessResultFromStream(response) {
134
+ if (response.status !== "complete") {
135
+ throw new LivenessApiError("Stream not complete", "stream_incomplete", 400);
136
+ }
137
+ if (!response.verdict) {
138
+ throw new LivenessApiError(response.error ?? "No verdict received", "no_verdict", 500);
139
+ }
140
+ return {
141
+ verdict: response.verdict,
142
+ confidence: response.confidence ?? 0,
143
+ score: response.score ?? 0,
144
+ sessionId: response.session_id,
145
+ processingMs: response.processing_ms ?? 0,
146
+ framesProcessed: response.frames_processed ?? 0
147
+ };
148
+ }
132
149
  function generateSessionId() {
133
150
  if (typeof crypto !== "undefined" && crypto.randomUUID) {
134
151
  return crypto.randomUUID();
@@ -263,6 +280,116 @@ var LivenessClient = class {
263
280
  });
264
281
  return toLivenessResult(response);
265
282
  }
283
+ /**
284
+ * Send a single frame to the streaming endpoint with retry
285
+ *
286
+ * @param frame - Single frame to send
287
+ * @param options - Session and model options
288
+ * @returns Stream response with status
289
+ */
290
+ async sendStreamFrame(frame, options) {
291
+ const request = {
292
+ session_id: options.sessionId,
293
+ model: options.model,
294
+ source: options.source,
295
+ frame
296
+ };
297
+ return this.requestWithRetry(API_PATHS.fastCheckStream, {
298
+ method: "POST",
299
+ body: JSON.stringify(request)
300
+ });
301
+ }
302
+ /**
303
+ * Perform streaming liveness check by sending frames one at a time
304
+ *
305
+ * Each frame is sent separately to the streaming endpoint with individual retry.
306
+ * The last frame that completes the set will return the full liveness result.
307
+ *
308
+ * @param frames - Captured frames to analyze
309
+ * @param options - Additional options
310
+ * @param callbacks - Optional callbacks for progress tracking
311
+ * @returns Liveness result
312
+ */
313
+ async fastCheckStream(frames, options = {}, callbacks) {
314
+ const sessionId = options.sessionId ?? generateSessionId();
315
+ const model = options.model ?? "10";
316
+ const source = options.source ?? "live";
317
+ const frameDataList = toFrameData(frames);
318
+ const total = frameDataList.length;
319
+ let finalResponse = null;
320
+ const sendPromises = frameDataList.map(async (frameData, index) => {
321
+ const response = await this.sendStreamFrame(frameData, {
322
+ sessionId,
323
+ model,
324
+ source
325
+ });
326
+ callbacks?.onFrameSent?.(index + 1, total);
327
+ if (response.status === "buffering") {
328
+ callbacks?.onFrameBuffered?.(response.frames_received, response.frames_required);
329
+ }
330
+ return response;
331
+ });
332
+ const responses = await Promise.all(sendPromises);
333
+ finalResponse = responses.find((r) => r.status === "complete") ?? null;
334
+ if (!finalResponse) {
335
+ const lastResponse = responses[responses.length - 1];
336
+ if (lastResponse) {
337
+ throw new LivenessApiError(
338
+ `Streaming incomplete: received ${lastResponse.frames_received}/${lastResponse.frames_required} frames`,
339
+ "stream_incomplete",
340
+ 400
341
+ );
342
+ }
343
+ throw new LivenessApiError(
344
+ "Streaming failed: no responses received",
345
+ "stream_incomplete",
346
+ 400
347
+ );
348
+ }
349
+ return toLivenessResultFromStream(finalResponse);
350
+ }
351
+ /**
352
+ * Perform streaming liveness check by sending frames sequentially
353
+ *
354
+ * Alternative to fastCheckStream that sends frames one by one in order.
355
+ * Useful when parallel uploads are not desired or network is constrained.
356
+ *
357
+ * @param frames - Captured frames to analyze
358
+ * @param options - Additional options
359
+ * @param callbacks - Optional callbacks for progress tracking
360
+ * @returns Liveness result
361
+ */
362
+ async fastCheckStreamSequential(frames, options = {}, callbacks) {
363
+ const sessionId = options.sessionId ?? generateSessionId();
364
+ const model = options.model ?? "10";
365
+ const source = options.source ?? "live";
366
+ const frameDataList = toFrameData(frames);
367
+ const total = frameDataList.length;
368
+ let finalResponse = null;
369
+ for (const frameData of frameDataList) {
370
+ const response = await this.sendStreamFrame(frameData, {
371
+ sessionId,
372
+ model,
373
+ source
374
+ });
375
+ const currentIndex = frameData.index;
376
+ callbacks?.onFrameSent?.(currentIndex + 1, total);
377
+ if (response.status === "buffering") {
378
+ callbacks?.onFrameBuffered?.(response.frames_received, response.frames_required);
379
+ } else if (response.status === "complete") {
380
+ finalResponse = response;
381
+ break;
382
+ }
383
+ }
384
+ if (!finalResponse) {
385
+ throw new LivenessApiError(
386
+ "Streaming did not complete after all frames sent",
387
+ "stream_incomplete",
388
+ 400
389
+ );
390
+ }
391
+ return toLivenessResultFromStream(finalResponse);
392
+ }
266
393
  // ===========================================================================
267
394
  // Verify Endpoint (Spatial Features)
268
395
  // ===========================================================================
@@ -519,6 +646,7 @@ var FrameQueue = class {
519
646
 
520
647
  // src/types/models.ts
521
648
  var MODEL_CONFIGS = {
649
+ // Standard fast-check models
522
650
  "10": {
523
651
  type: "10",
524
652
  minFrames: 10,
@@ -536,6 +664,104 @@ var MODEL_CONFIGS = {
536
664
  minFrames: 250,
537
665
  recommendedFrames: 250,
538
666
  description: "High-accuracy model - 250 frames, best accuracy"
667
+ },
668
+ // Hybrid V2 models with physiological features
669
+ "hybrid-v2-10": {
670
+ type: "hybrid-v2-10",
671
+ minFrames: 10,
672
+ recommendedFrames: 10,
673
+ description: "Hybrid V2 10-frame model with physio features"
674
+ },
675
+ "hybrid-v2-30": {
676
+ type: "hybrid-v2-30",
677
+ minFrames: 30,
678
+ recommendedFrames: 30,
679
+ description: "Hybrid V2 30-frame model with physio features"
680
+ },
681
+ "hybrid-v2-50": {
682
+ type: "hybrid-v2-50",
683
+ minFrames: 50,
684
+ recommendedFrames: 50,
685
+ description: "Hybrid V2 50-frame model with physio features"
686
+ },
687
+ "hybrid-v2-60": {
688
+ type: "hybrid-v2-60",
689
+ minFrames: 60,
690
+ recommendedFrames: 60,
691
+ description: "Hybrid V2 60-frame model with physio features"
692
+ },
693
+ "hybrid-v2-90": {
694
+ type: "hybrid-v2-90",
695
+ minFrames: 90,
696
+ recommendedFrames: 90,
697
+ description: "Hybrid V2 90-frame model with physio features"
698
+ },
699
+ "hybrid-v2-100": {
700
+ type: "hybrid-v2-100",
701
+ minFrames: 100,
702
+ recommendedFrames: 100,
703
+ description: "Hybrid V2 100-frame model with physio features"
704
+ },
705
+ "hybrid-v2-125": {
706
+ type: "hybrid-v2-125",
707
+ minFrames: 125,
708
+ recommendedFrames: 125,
709
+ description: "Hybrid V2 125-frame model with physio features"
710
+ },
711
+ "hybrid-v2-150": {
712
+ type: "hybrid-v2-150",
713
+ minFrames: 150,
714
+ recommendedFrames: 150,
715
+ description: "Hybrid V2 150-frame model with physio features"
716
+ },
717
+ "hybrid-v2-250": {
718
+ type: "hybrid-v2-250",
719
+ minFrames: 250,
720
+ recommendedFrames: 250,
721
+ description: "Hybrid V2 250-frame model with physio features"
722
+ },
723
+ // Mixed models (FastLivenessDetector with mixed-trained weights)
724
+ "mixed-10": {
725
+ type: "mixed-10",
726
+ minFrames: 10,
727
+ recommendedFrames: 10,
728
+ description: "Mixed 10-frame model"
729
+ },
730
+ "mixed-30": {
731
+ type: "mixed-30",
732
+ minFrames: 30,
733
+ recommendedFrames: 30,
734
+ description: "Mixed 30-frame model"
735
+ },
736
+ "mixed-60": {
737
+ type: "mixed-60",
738
+ minFrames: 60,
739
+ recommendedFrames: 60,
740
+ description: "Mixed 60-frame model"
741
+ },
742
+ "mixed-90": {
743
+ type: "mixed-90",
744
+ minFrames: 90,
745
+ recommendedFrames: 90,
746
+ description: "Mixed 90-frame model"
747
+ },
748
+ "mixed-120": {
749
+ type: "mixed-120",
750
+ minFrames: 120,
751
+ recommendedFrames: 120,
752
+ description: "Mixed 120-frame model"
753
+ },
754
+ "mixed-150": {
755
+ type: "mixed-150",
756
+ minFrames: 150,
757
+ recommendedFrames: 150,
758
+ description: "Mixed 150-frame model"
759
+ },
760
+ "mixed-250": {
761
+ type: "mixed-250",
762
+ minFrames: 250,
763
+ recommendedFrames: 250,
764
+ description: "Mixed 250-frame model"
539
765
  }
540
766
  };
541
767
  var HYBRID_MODEL_CONFIGS = {
@@ -1173,6 +1399,7 @@ export {
1173
1399
  toFrameData,
1174
1400
  toHybridFrameData,
1175
1401
  toLivenessResult,
1402
+ toLivenessResultFromStream,
1176
1403
  validateApiKey,
1177
1404
  validateFrameCount,
1178
1405
  validateFrameData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moveris/shared",
3
- "version": "1.0.2",
3
+ "version": "2.0.0",
4
4
  "description": "Core business logic for Moveris Live SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",