@moveris/shared 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +76 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -80,11 +80,33 @@ const result = await client.fastCheck(frames, {
80
80
 
81
81
  ##### `fastCheckCrops(crops, options)`
82
82
 
83
- Perform fast liveness check with pre-cropped 224x224 face images. Use this when you handle face detection client-side.
83
+ Perform fast liveness check with pre-cropped 224x224 face images. Use this when you handle face detection client-side. Expects `CropData[]` (no timestamps — only `index` and `pixels`).
84
84
 
85
85
  ```typescript
86
+ import type { CropData } from '@moveris/shared';
87
+
88
+ const crops: CropData[] = capturedFrames.map((f) => ({
89
+ index: f.index,
90
+ pixels: f.pixels, // base64 224x224 PNG
91
+ }));
92
+
86
93
  const result = await client.fastCheckCrops(crops, {
87
- model: '50',
94
+ model: '10',
95
+ source: 'live',
96
+ });
97
+ ```
98
+
99
+ ##### `streamFrame(frame, options)`
100
+
101
+ Send a single frame to the streaming endpoint. Returns the API response which may include a partial or final result. Used internally by `useLiveness` for sequential streaming.
102
+
103
+ ```typescript
104
+ const response = await client.streamFrame(frame, {
105
+ sessionId: 'uuid',
106
+ model: '10',
107
+ source: 'live',
108
+ frameIndex: 0,
109
+ totalFrames: 10,
88
110
  });
89
111
  ```
90
112
 
@@ -160,14 +182,23 @@ const job = await client.waitForJobResult('job-uuid', 30);
160
182
  Model selection for liveness detection speed/accuracy trade-off.
161
183
 
162
184
  ```typescript
163
- type FastCheckModel = '10' | '50' | '250';
185
+ type FastCheckModel =
186
+ | '10'
187
+ | '50'
188
+ | '250' // Standard models
189
+ | 'hybrid-v2-10'
190
+ | 'hybrid-v2-50' // Hybrid V2 (physiological features)
191
+ | 'mixed-10'; // Mixed (visual + physiological scoring)
164
192
  ```
165
193
 
166
- | Value | Frames | Description |
167
- | ------- | ------ | --------------------------------- |
168
- | `'10'` | 10 | Fast verification, lowest latency |
169
- | `'50'` | 50 | Balanced speed and accuracy |
170
- | `'250'` | 250 | Highest accuracy, slower |
194
+ | Value | Frames | Category | Description |
195
+ | ---------------- | ------ | --------- | ----------------------------------------- |
196
+ | `'10'` | 10 | Standard | Fast verification, lowest latency |
197
+ | `'50'` | 50 | Standard | Balanced speed and accuracy |
198
+ | `'250'` | 250 | Standard | Highest accuracy, slower |
199
+ | `'hybrid-v2-10'` | 10 | Hybrid V2 | Visual + physiological feature extraction |
200
+ | `'hybrid-v2-50'` | 50 | Hybrid V2 | Higher accuracy physiological features |
201
+ | `'mixed-10'` | 10 | Mixed | Combined visual + physiological scoring |
171
202
 
172
203
  #### FrameSource
173
204
 
@@ -236,6 +267,17 @@ interface CapturedFrame {
236
267
  }
237
268
  ```
238
269
 
270
+ #### CropData
271
+
272
+ Pre-cropped face image for the `fast-check-crops` endpoint. Omits `timestampMs` since timing is not needed for cropped submissions.
273
+
274
+ ```typescript
275
+ interface CropData {
276
+ index: number; // Frame sequence number (0-based)
277
+ pixels: string; // Base64-encoded 224x224 PNG image
278
+ }
279
+ ```
280
+
239
281
  ---
240
282
 
241
283
  ### Utilities
@@ -424,10 +466,28 @@ const inOval = isFaceInOval(faceBbox, ovalRegion);
424
466
  console.log(inOval.isInOval); // true/false
425
467
  console.log(inOval.alignmentScore); // 0-1
426
468
 
427
- // Calculate crop region for face
469
+ // Calculate crop region for face (224x224, aligned with cognito-check constants)
428
470
  const cropRegion = calculateFaceCropRegion(faceBbox, frameWidth, frameHeight);
471
+ // { x, y, size } — square crop region in pixel coordinates
472
+
473
+ // Calculate adaptive crop multiplier based on face size
474
+ import { calculateAdaptiveCropMultiplier } from '@moveris/shared';
475
+ const multiplier = calculateAdaptiveCropMultiplier(faceSize, videoSize);
476
+ // Returns 1.8–2.5x (matched to cognito-check for ~50% face coverage)
429
477
  ```
430
478
 
479
+ #### Crop Constants (aligned with cognito-check)
480
+
481
+ These constants control how face crops are generated for the `fast-check-crops` endpoint:
482
+
483
+ | Constant | Value | Description |
484
+ | -------------------------------- | ----- | ------------------------------------------------ |
485
+ | `IDEAL_CROP_MULTIPLIER` | 2.0 | Default crop region = 2x face size |
486
+ | `MIN_CROP_MULTIPLIER` | 1.8 | Minimum crop (face very close) |
487
+ | `MAX_CROP_MULTIPLIER` | 2.5 | Maximum crop (face very far) |
488
+ | `FACE_CENTER_VERTICAL_OFFSET` | 0.05 | Slight upward shift to include forehead for rPPG |
489
+ | `TARGET_FACE_PERCENTAGE_IN_CROP` | 0.5 | Face should occupy ~50% of 224x224 crop |
490
+
431
491
  ---
432
492
 
433
493
  ## Configuration Constants
@@ -456,7 +516,14 @@ import type {
456
516
  FrameSource,
457
517
  Verdict,
458
518
  CapturedFrame,
519
+ CropData,
459
520
  LivenessClientConfig,
521
+ DetectionResult,
522
+ DetectionSummary,
523
+ FaceBoundingBox,
524
+ HeadPose,
525
+ FaceLandmarkPoint,
526
+ LandmarkValidationResult,
460
527
  } from '@moveris/shared';
461
528
  ```
462
529
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moveris/shared",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Core business logic for Moveris Live SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",