@incodetech/core 0.0.0-dev-20260512-cffbe28 → 0.0.0-dev-20260513-0ec71c0

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 (77) hide show
  1. package/dist/{BaseWasmProvider-IiHnsP8E.esm.js → BaseWasmProvider-rCpBxg2n.esm.js} +232 -5
  2. package/dist/{WasmUtilProvider-BrEYcdhY.esm.js → WasmUtilProvider--NH11WMy.esm.js} +1 -1
  3. package/dist/ae-signature.d.ts +1 -1
  4. package/dist/authentication.d.ts +5 -5
  5. package/dist/authentication.esm.js +16 -16
  6. package/dist/{authenticationManager-BuChl5GH.d.ts → authenticationManager-BnltMEfq.d.ts} +1 -1
  7. package/dist/{authenticationManager-CKDxnLtG.esm.js → authenticationManager-DcGiJ5zB.esm.js} +3 -3
  8. package/dist/{authenticationStateMachine-BNs4VCxh.esm.js → authenticationStateMachine-BkxEuiOe.esm.js} +11 -3
  9. package/dist/{backCameraStream-DWZ1cNVA.esm.js → backCameraStream-BKC7QXRJ.esm.js} +2 -2
  10. package/dist/camera.esm.js +2 -2
  11. package/dist/consent.d.ts +52 -52
  12. package/dist/cpf-ocr.d.ts +20 -20
  13. package/dist/cross-document-data-match.esm.js +1 -1
  14. package/dist/curp-validation.d.ts +1 -1
  15. package/dist/{deepsightLoader-BMeAmiNh.esm.js → deepsightLoader-DVjWQrsv.esm.js} +6 -6
  16. package/dist/{deepsightService-IxmrmdKl.esm.js → deepsightService-Dv6kvzph.esm.js} +2 -2
  17. package/dist/{deepsightService-CGSDjjBz.d.ts → deepsightService-Kuw9roIJ.d.ts} +1 -1
  18. package/dist/device.esm.js +3 -3
  19. package/dist/document-capture.d.ts +77 -77
  20. package/dist/document-capture.esm.js +4 -4
  21. package/dist/document-upload.d.ts +46 -46
  22. package/dist/document-upload.esm.js +3 -3
  23. package/dist/{documentCaptureStateMachine-CuanhXvs.esm.js → documentCaptureStateMachine-CEm-9zrh.esm.js} +1 -1
  24. package/dist/ekyb.esm.js +3 -3
  25. package/dist/{ekybStateMachine-tZ1_L9vE.esm.js → ekybStateMachine-Cw4N-GB5.esm.js} +1 -1
  26. package/dist/electronic-signature.d.ts +1 -1
  27. package/dist/extensibility.d.ts +7 -7
  28. package/dist/extensibility.esm.js +21 -21
  29. package/dist/{faceCaptureManagerFactory-FX5Lw2Q5.d.ts → faceCaptureManagerFactory-DmHbKbyC.d.ts} +66 -3
  30. package/dist/{faceCaptureManagerFactory-ByAGjOLF.esm.js → faceCaptureManagerFactory-fu-9hWf5.esm.js} +2 -0
  31. package/dist/{faceCaptureSetup-CUzqUwkP.esm.js → faceCaptureSetup-DuyxqX2C.esm.js} +162 -19
  32. package/dist/flow-events.d.ts +2 -2
  33. package/dist/flow.d.ts +9 -5
  34. package/dist/flow.esm.js +2 -2
  35. package/dist/{flowServices-CLo2qihS.esm.js → flowServices-BoXJgwso.esm.js} +14 -1
  36. package/dist/geolocation.esm.js +2 -2
  37. package/dist/{geolocationStateMachine-15aagr2_.esm.js → geolocationStateMachine-BYWUPbNs.esm.js} +1 -1
  38. package/dist/{getDeviceClass-DmoqR7G2.esm.js → getDeviceClass-C1ZS2XJL.esm.js} +1 -1
  39. package/dist/home.d.ts +11 -11
  40. package/dist/http.d.ts +9 -0
  41. package/dist/id-ocr.d.ts +52 -52
  42. package/dist/id.d.ts +4 -4
  43. package/dist/id.esm.js +14 -14
  44. package/dist/{idCaptureManager-DiFBYm7h.d.ts → idCaptureManager-Bg2va24b.d.ts} +2 -2
  45. package/dist/{idCaptureManager-ZtfBOR6V.esm.js → idCaptureManager-WnnPecUR.esm.js} +1 -1
  46. package/dist/{idCaptureStateMachine-BuX1-VlB.esm.js → idCaptureStateMachine-DiUfiVtU.esm.js} +11 -11
  47. package/dist/identity-reuse.d.ts +43 -43
  48. package/dist/{index-BRdxM5zm.d.ts → index-CRvEjMgP.d.ts} +119 -119
  49. package/dist/{index-CmFkidgy.d.ts → index-UH-vOq3x.d.ts} +1 -1
  50. package/dist/index.d.ts +2 -2
  51. package/dist/index.esm.js +4 -4
  52. package/dist/mandatory-consent.d.ts +54 -54
  53. package/dist/{permissionServices-ACBX6sNZ.esm.js → permissionServices-Cdxqlwqz.esm.js} +1 -1
  54. package/dist/qe-signature.d.ts +1 -1
  55. package/dist/{recordingService-DMaVUhWY.esm.js → recordingService-D7oQbN6c.esm.js} +204 -174
  56. package/dist/selfie.d.ts +5 -5
  57. package/dist/selfie.esm.js +16 -16
  58. package/dist/{selfieManager-DC9hKgt7.esm.js → selfieManager-BvY_JjgO.esm.js} +3 -3
  59. package/dist/{selfieManager-DPQzO4ua.d.ts → selfieManager-CQtRqcjI.d.ts} +1 -1
  60. package/dist/{selfieStateMachine-DvOTE42w.esm.js → selfieStateMachine-Bq5AS2Ym.esm.js} +22 -10
  61. package/dist/{session-DAspZUCj.esm.js → session-CCVzeyXu.esm.js} +1 -1
  62. package/dist/session.esm.js +1 -1
  63. package/dist/{setup-DM301Lyz.d.ts → setup-CsJ6FYyF.d.ts} +1 -1
  64. package/dist/{setup-DyspWyTY.esm.js → setup-DVRsRzJX.esm.js} +38 -183
  65. package/dist/stats.esm.js +1 -1
  66. package/dist/{types-BA181GDD.d.ts → types-DkXZpS0R.d.ts} +14 -0
  67. package/dist/{warmup-DHGg8wQZ.d.ts → warmup-C6O7yhfX.d.ts} +5 -2
  68. package/dist/wasm.d.ts +3 -3
  69. package/dist/wasm.esm.js +4 -4
  70. package/dist/workflow.d.ts +86 -86
  71. package/dist/workflow.esm.js +20 -20
  72. package/package.json +3 -3
  73. /package/dist/{ITimerCapability-2pw-S97e.esm.js → ITimerCapability-3xSd36bT.esm.js} +0 -0
  74. /package/dist/{MotionSensorProvider-DJMsPght.esm.js → MotionSensorProvider-Dt_lF3Z8.esm.js} +0 -0
  75. /package/dist/{getBrowser-Y88tNVud.esm.js → getBrowser-Bl0PlyDu.esm.js} +0 -0
  76. /package/dist/{platform-Dpzd9p3X.esm.js → platform-CDh4uv5Y.esm.js} +0 -0
  77. /package/dist/{stats-Bqq9IKre.esm.js → stats-qUsejORa.esm.js} +0 -0
@@ -179,6 +179,7 @@ let WasmPipelineType = /* @__PURE__ */ function(WasmPipelineType$1) {
179
179
  WasmPipelineType$1[WasmPipelineType$1["IdVideoSelfiePipeline"] = 2] = "IdVideoSelfiePipeline";
180
180
  WasmPipelineType$1[WasmPipelineType$1["SelfieWithAggregationMetrics"] = 3] = "SelfieWithAggregationMetrics";
181
181
  WasmPipelineType$1[WasmPipelineType$1["SelfieWithQualityMetrics"] = 4] = "SelfieWithQualityMetrics";
182
+ WasmPipelineType$1[WasmPipelineType$1["OnDeviceSelfieWorkflow"] = 5] = "OnDeviceSelfieWorkflow";
182
183
  return WasmPipelineType$1;
183
184
  }({});
184
185
 
@@ -198,6 +199,181 @@ async function wasmCallWrapper(concurrency, wasmMethod, useSemaphore = true, ...
198
199
  await innerCall();
199
200
  }
200
201
 
202
+ //#endregion
203
+ //#region ../infra/src/wasm/wasmWebClient.ts
204
+ /**
205
+ * JavaScript bridge for the C++ `WebClient` exposed by `webLib.wasm`.
206
+ *
207
+ * The pinned WASM bundle ships a `WebClient` class alongside the ML pipeline
208
+ * APIs. This module instantiates it once (sharing the singleton `wasmModule`
209
+ * with `mlWasmJSApi`) and exposes a small TypeScript-friendly surface that
210
+ * `createWasmApi` can drive.
211
+ *
212
+ * Concurrency model mirrors the legacy implementation:
213
+ * - 4-slot semaphore keyed by per-request `threadId` so multiple HTTP calls
214
+ * can run in parallel without trampling shared C++ state.
215
+ * - Each WASM-side request method returns `false` while in flight; we
216
+ * busy-poll via {@link wasmCallWrapper}.
217
+ * - Result extraction (`getRequestResult`) is per-thread.
218
+ *
219
+ * Encryption support: `setupConnection` accepts an `encryptionEnabled` flag
220
+ * that triggers the in-binary RSA/AES handshake (always using SHA-256 OAEP).
221
+ * {@link enableWasmEncryption} is a stateless helper that re-runs the
222
+ * handshake with the caller-supplied connection params. State lives in the
223
+ * C++ binary and (for SDK config) in `@incodetech/core`'s `setup.ts` — this
224
+ * module caches nothing.
225
+ */
226
+ const HTTP_CONCURRENCY = 4;
227
+ var WasmWebClientError = class extends Error {
228
+ constructor(message, statusCode, data) {
229
+ super(message);
230
+ this.name = "WasmWebClientError";
231
+ this.status = statusCode;
232
+ this.statusCode = statusCode;
233
+ if (statusCode > 0 || data !== void 0) this.response = {
234
+ status: statusCode,
235
+ data
236
+ };
237
+ }
238
+ };
239
+ let webClientApi = null;
240
+ let initPromise = null;
241
+ let semaphore = new SemaphoreProvider(HTTP_CONCURRENCY);
242
+ const isWebClientWasm = (mod) => {
243
+ return typeof mod.WebClient === "function";
244
+ };
245
+ const toStringRecord = (obj) => {
246
+ if (!obj) return void 0;
247
+ const result = {};
248
+ for (const key of Object.keys(obj)) {
249
+ const value = obj[key];
250
+ if (value === void 0 || value === null) continue;
251
+ result[key] = String(value);
252
+ }
253
+ return result;
254
+ };
255
+ /**
256
+ * Loads the shared WASM module (if not already loaded) and instantiates the
257
+ * C++ `WebClient`. Idempotent — repeated calls reuse the existing instance.
258
+ */
259
+ async function initializeWasmWebClient(wasmPath, wasmSimdPath, glueCodePath, useSimd) {
260
+ if (webClientApi) return;
261
+ if (initPromise) return initPromise;
262
+ initPromise = (async () => {
263
+ try {
264
+ const { wasmModule } = await loadWasmModule({
265
+ wasmPath,
266
+ wasmSimdPath,
267
+ glueCodePath,
268
+ useSimd
269
+ });
270
+ if (!isWebClientWasm(wasmModule)) throw new Error("WASM module does not expose a WebClient class. Update webLib.wasm to a build that includes WebClient.");
271
+ webClientApi = new wasmModule.WebClient();
272
+ } catch (error) {
273
+ initPromise = null;
274
+ throw error;
275
+ }
276
+ })();
277
+ return initPromise;
278
+ }
279
+ /**
280
+ * Configures the C++ WebClient connection. Safe to call multiple times — each
281
+ * call resets the underlying session and re-applies default headers.
282
+ *
283
+ * `defaultHeaders` are applied **before** `createApi`, so the in-binary RSA
284
+ * handshake (`GET /e2ee/key/v2` + `POST /e2ee/key`) sees the same headers as
285
+ * data requests. Without this ordering, environments that require auth/version
286
+ * headers on the handshake (e.g. `x-api-key`, `api-version`) would 401/4xx
287
+ * before any encrypted traffic ever flowed.
288
+ *
289
+ * OAEP padding is hardcoded to SHA-256 (we always pass `useSha256 = true` into
290
+ * the C++ binary).
291
+ */
292
+ async function setupWasmConnection(apiURL, token, encryptionEnabled, defaultHeaders) {
293
+ const api = ensureReady();
294
+ api.resetSessionState?.();
295
+ api.setDefaultHeaders?.(defaultHeaders);
296
+ api.createApi(apiURL, token, true, encryptionEnabled);
297
+ }
298
+ /**
299
+ * Re-runs the connection handshake with `encryptionEnabled = true`. Stateless:
300
+ * callers (currently `@incodetech/core`'s `setup()`) own the connection params
301
+ * and supply them on every call. Use this to upgrade an existing non-encrypted
302
+ * WASM connection to encrypted at runtime.
303
+ */
304
+ async function enableWasmEncryption(params) {
305
+ await setupWasmConnection(params.apiURL, params.token ?? "", true, params.defaultHeaders);
306
+ }
307
+ /**
308
+ * Executes a single HTTP request through the WASM WebClient.
309
+ *
310
+ * Acquires a semaphore slot for `threadId`, registers progress callbacks, runs
311
+ * the request via {@link wasmCallWrapper} (busy-polls until the WASM method
312
+ * returns `true`), then extracts the per-thread result. Throws
313
+ * {@link WasmWebClientError} on non-2xx or transport errors.
314
+ *
315
+ * The `ie` (inline-encryption) flag is forwarded to the C++ WebClient for
316
+ * mutating methods. Default `false` — the SDK HTTP path leaves payloads
317
+ * unencrypted at the WebClient layer. The C++ `WebApi.postFaceResults`
318
+ * pre-encrypts its JSON via `SessionEncryptor` and calls back into this
319
+ * function with `ie=true`; see {@link createWebApiHostAdapter}.
320
+ */
321
+ async function executeWasmRequest(method, url, body, headers, params, timeout, onUploadProgress, ie = false) {
322
+ const api = ensureReady();
323
+ const stringParams = toStringRecord(params);
324
+ return semaphore.withLock(async (threadId) => {
325
+ if (onUploadProgress && api.setOnUploadProgress) api.setOnUploadProgress((event) => {
326
+ try {
327
+ onUploadProgress(event);
328
+ } catch (error) {
329
+ console.error("WasmWebClient: error in onUploadProgress callback", error);
330
+ }
331
+ });
332
+ try {
333
+ await wasmCallWrapper(semaphore, () => callWasmMethod(api, method, threadId, url, body, headers, stringParams, timeout, ie), false);
334
+ return readResult(api, threadId);
335
+ } finally {
336
+ api.clearOnUploadProgress?.(threadId);
337
+ api.clearOnDownloadProgress?.(threadId);
338
+ }
339
+ });
340
+ }
341
+ function callWasmMethod(api, method, threadId, url, body, headers, params, timeout, ie) {
342
+ switch (method) {
343
+ case "GET": return api.get(threadId, url, params, headers, timeout);
344
+ case "POST": return api.post(threadId, url, body ?? {}, headers, params, timeout, ie);
345
+ case "PUT": return api.put(threadId, url, body ?? {}, headers, params, timeout, ie);
346
+ case "PATCH": return api.patch(threadId, url, body ?? {}, headers, params, timeout, ie);
347
+ case "DELETE": return api.del(threadId, url, body ?? {}, headers, params, timeout, ie);
348
+ default: throw new Error(`Unsupported WASM HTTP method: ${method}`);
349
+ }
350
+ }
351
+ const DEFAULT_WEBAPI_TIMEOUT_MS = 3e4;
352
+ let webApiHttpTransport = null;
353
+ function setWebApiHttpTransport(transport) {
354
+ webApiHttpTransport = transport;
355
+ }
356
+ function createWebApiHostAdapter() {
357
+ return { post(url, body, config) {
358
+ const effectiveConfig = config ?? {};
359
+ const transport = webApiHttpTransport;
360
+ if (transport) return transport(url, body, effectiveConfig);
361
+ return executeWasmRequest("POST", url, body, effectiveConfig.headers ?? {}, effectiveConfig.params, effectiveConfig.timeout ?? DEFAULT_WEBAPI_TIMEOUT_MS, void 0, effectiveConfig.ie === true);
362
+ } };
363
+ }
364
+ function readResult(api, threadId) {
365
+ const response = api.getRequestResult(threadId);
366
+ if (response.hasError) throw new WasmWebClientError(response.errorMessage || "WasmWebClient request failed", response.statusCode, response.result);
367
+ return {
368
+ data: response.result,
369
+ status: response.statusCode
370
+ };
371
+ }
372
+ function ensureReady() {
373
+ if (!webClientApi) throw new Error("WasmWebClient not initialized. Call initializeWasmWebClient() first.");
374
+ return webClientApi;
375
+ }
376
+
201
377
  //#endregion
202
378
  //#region ../infra/src/wasm/mlWasmJSApi.ts
203
379
  var MlWasmJSApi = class MlWasmJSApi {
@@ -210,6 +386,7 @@ var MlWasmJSApi = class MlWasmJSApi {
210
386
  this.utilityApi = null;
211
387
  this.idCaptureWasmApi = null;
212
388
  this.faceProcessingWasmApi = null;
389
+ this.webApi = null;
213
390
  this.imageWidth_ = null;
214
391
  this.imageHeight_ = null;
215
392
  this.pipelines_ = null;
@@ -245,6 +422,7 @@ var MlWasmJSApi = class MlWasmJSApi {
245
422
  this.utilityApi = new this.wasmModule.UtilityApi();
246
423
  this.idCaptureWasmApi = new this.wasmModule.IdCaptureApi();
247
424
  this.faceProcessingWasmApi = new this.wasmModule.FaceProcessingApi();
425
+ this.webApi = new this.wasmModule.WebApi(createWebApiHostAdapter());
248
426
  this.isInitialized_ = true;
249
427
  return simdUsed;
250
428
  }
@@ -322,6 +500,8 @@ var MlWasmJSApi = class MlWasmJSApi {
322
500
  this.faceProcessingWasmApi.delete();
323
501
  this.faceProcessingWasmApi = null;
324
502
  }
503
+ if (this.webApi && typeof this.webApi.delete === "function") this.webApi.delete();
504
+ this.webApi = null;
325
505
  this.wasmModule = null;
326
506
  this.isInitialized_ = false;
327
507
  }
@@ -368,7 +548,8 @@ var MlWasmJSApi = class MlWasmJSApi {
368
548
  case WasmPipelineType.IdBarcodeAndTextQualityPipeline: return this.idCaptureWasmApi.runIdCaptureWorkflow(this.pipelineTypeToWasmEnum(type));
369
549
  case WasmPipelineType.IdVideoSelfiePipeline: return this.idCaptureWasmApi.runIdVideoSelfieWorkflow();
370
550
  case WasmPipelineType.SelfieWithAggregationMetrics:
371
- case WasmPipelineType.SelfieWithQualityMetrics: return this.faceProcessingWasmApi.runSelfieWorkflow(this.pipelineTypeToWasmEnum(type));
551
+ case WasmPipelineType.SelfieWithQualityMetrics:
552
+ case WasmPipelineType.OnDeviceSelfieWorkflow: return this.faceProcessingWasmApi.runSelfieWorkflow(this.pipelineTypeToWasmEnum(type));
372
553
  default: throw new Error("Unknown pipeline type");
373
554
  }
374
555
  }
@@ -388,9 +569,9 @@ var MlWasmJSApi = class MlWasmJSApi {
388
569
  this.checkWasmInitialization("Unable to set face position constraints, cpp API hasn't been initialized");
389
570
  this.faceProcessingWasmApi.setFacePositionConstraints(this.pipelineTypeToWasmEnum(type), minX, minY, maxX, maxY);
390
571
  }
391
- async setFaceDetectionThresholds(type, brightnessThreshold, blurrinessThreshold, tiltRotationAngleThreshold, minMagicCropSize, autocaptureInterval, minFaceQualityScore, faceOcclusionThreshold) {
572
+ async setFaceDetectionThresholds(type, brightnessThreshold, blurrinessThreshold, tiltRotationAngleThreshold, minMagicCropSize, autocaptureInterval, minFaceQualityScore, faceOcclusionThreshold, getReadyDelay, framesAggregationInterval, minFramesWithFace) {
392
573
  this.checkWasmInitialization("Unable to set face detection thresholds, cpp API hasn't been initialized");
393
- this.faceProcessingWasmApi.setFaceProcessingThresholds(this.pipelineTypeToWasmEnum(type), brightnessThreshold, blurrinessThreshold, tiltRotationAngleThreshold, minMagicCropSize, autocaptureInterval, minFaceQualityScore, faceOcclusionThreshold);
574
+ this.faceProcessingWasmApi.setFaceProcessingThresholds(this.pipelineTypeToWasmEnum(type), brightnessThreshold, blurrinessThreshold, tiltRotationAngleThreshold, minMagicCropSize, autocaptureInterval, minFaceQualityScore, faceOcclusionThreshold, getReadyDelay, framesAggregationInterval, minFramesWithFace);
394
575
  }
395
576
  async setFaceAttributesThresholds(type, headwearThreshold, lensesThreshold, closedEyesThreshold, maskThreshold) {
396
577
  this.checkWasmInitialization("Unable to set face attributes thresholds, cpp API hasn't been initialized");
@@ -544,6 +725,36 @@ var MlWasmJSApi = class MlWasmJSApi {
544
725
  this.checkWasmInitialization("Unable to ckvcks, cpp API hasn't been initialized");
545
726
  this.utilityApi.ckvcks(data);
546
727
  }
728
+ /**
729
+ * Synchronous manual-capture entry point for the OnDevice selfie workflow.
730
+ * Runs face detection + the full on-device quality / liveness / age pipeline
731
+ * on a single canvas image and stages the results inside the WASM `WebApi`
732
+ * for the next {@link postFaceResults} call. No polling, no semaphore wrap.
733
+ *
734
+ * Mirrors `ml-wasm-kit/WasmApi.processPhoto`.
735
+ */
736
+ processPhoto(canvas) {
737
+ this.checkWasmInitialization("Unable to process photo, cpp API hasn't been initialized");
738
+ this.faceProcessingWasmApi.processPhoto(canvas);
739
+ }
740
+ /**
741
+ * POSTs the staged on-device face-results JSON to `/omni/add/face-results`
742
+ * via the C++ `WebApi`. The C++ side encrypts the body with
743
+ * `SessionEncryptor` and routes through the WASM `WebClient` with inline
744
+ * encryption (`ie=true`) — this does NOT depend on the WebClient E2EE
745
+ * session setup, so it works whether `setupWasmConnection` was called with
746
+ * `encryptionEnabled` true or false.
747
+ *
748
+ * Reads from the `WebApi` instance constructed in {@link initialize}. The
749
+ * C++ `OnDeviceSelfieWorkflow` has already staged the aggregated best-shot
750
+ * results into that instance via `WebApi::setFaceResults(...)` during
751
+ * per-frame processing (auto-capture) or via {@link processPhoto}
752
+ * (manual-capture).
753
+ */
754
+ postFaceResults(config) {
755
+ this.checkWasmInitialization("Unable to post face results, cpp API hasn't been initialized");
756
+ return this.webApi.postFaceResults(config ?? {});
757
+ }
547
758
  pipelineTypeToWasmEnum(type) {
548
759
  switch (type) {
549
760
  case WasmPipelineType.IdBlurGlarePipeline: return this.wasmModule.WorkflowType.IdBlurGlareWorkflow;
@@ -551,6 +762,7 @@ var MlWasmJSApi = class MlWasmJSApi {
551
762
  case WasmPipelineType.IdVideoSelfiePipeline: return this.wasmModule.WorkflowType.IdVideoSelfieWorkflow;
552
763
  case WasmPipelineType.SelfieWithAggregationMetrics: return this.wasmModule.WorkflowType.SelfieWithAggregationMetrics;
553
764
  case WasmPipelineType.SelfieWithQualityMetrics: return this.wasmModule.WorkflowType.SelfieWithQualityMetrics;
765
+ case WasmPipelineType.OnDeviceSelfieWorkflow: return this.wasmModule.WorkflowType.OnDeviceSelfieWorkflow;
554
766
  default: throw new Error("Unknown pipeline type");
555
767
  }
556
768
  }
@@ -561,6 +773,7 @@ var MlWasmJSApi = class MlWasmJSApi {
561
773
  case this.wasmModule.WorkflowType.IdVideoSelfieWorkflow: return WasmPipelineType.IdVideoSelfiePipeline;
562
774
  case this.wasmModule.WorkflowType.SelfieWithAggregationMetrics: return WasmPipelineType.SelfieWithAggregationMetrics;
563
775
  case this.wasmModule.WorkflowType.SelfieWithQualityMetrics: return WasmPipelineType.SelfieWithQualityMetrics;
776
+ case this.wasmModule.WorkflowType.OnDeviceSelfieWorkflow: return WasmPipelineType.OnDeviceSelfieWorkflow;
564
777
  default: throw new Error("Unknown pipeline type");
565
778
  }
566
779
  }
@@ -588,7 +801,12 @@ var mlWasmJSApi_default = MlWasmJSApi.getInstance();
588
801
 
589
802
  //#endregion
590
803
  //#region ../infra/src/wasm/warmup.ts
591
- /** Array of all available pipelines */
804
+ /**
805
+ * Pipelines preloaded when no explicit `pipelines` array is passed to
806
+ * {@link warmupWasm}. The on-device selfie bundle is opt-in (loaded only when
807
+ * a SELFIE/AUTH module has `onDeviceFaceResultsSubmissionEnabled: true`), so
808
+ * it is intentionally excluded here to keep the default warmup small.
809
+ */
592
810
  const WASM_PIPELINES = ["selfie", "idCapture"];
593
811
  /**
594
812
  * Default model files for each pipeline.
@@ -601,6 +819,14 @@ const DEFAULT_PIPELINE_MODELS = {
601
819
  "mls_regressor_4773007c657b4f05a460321456740d0f_fp16.ortmodelv2",
602
820
  "face_occlusion_v0_2_fp16.ortmodelv2"
603
821
  ],
822
+ onDeviceSelfie: [
823
+ "selfie_bf_angles_192x192_opset9_fp16.ortmodelv2",
824
+ "face_attributes_v1_3_fp16.ortmodelv2",
825
+ "mls_regressor_4773007c657b4f05a460321456740d0f_fp16.ortmodelv2",
826
+ "face_occlusion_v0_2_fp16.ortmodelv2",
827
+ "ondevice_physical_liveness_v2_1_fp16.ortmodelv2",
828
+ "age_estimation_v2_2_2_fp16.ortmodelv2"
829
+ ],
604
830
  idCapture: ["id_capture_2_01_fp16.ortmodelv2", "id_fiqa_19a81a0b9bf6492eb03b4667f6db4c85_fp16.ortmodelv2"]
605
831
  };
606
832
  let state = "idle";
@@ -611,6 +837,7 @@ let lastConfig = null;
611
837
  function mapPipelineToWasmType(pipeline) {
612
838
  switch (pipeline) {
613
839
  case "selfie": return WasmPipelineType.SelfieWithQualityMetrics;
840
+ case "onDeviceSelfie": return WasmPipelineType.OnDeviceSelfieWorkflow;
614
841
  case "idCapture": return WasmPipelineType.IdBlurGlarePipeline;
615
842
  default: throw new Error(`Unknown pipeline: ${pipeline}`);
616
843
  }
@@ -850,4 +1077,4 @@ var BaseWasmProvider = class {
850
1077
  };
851
1078
 
852
1079
  //#endregion
853
- export { WasmPipelineType as a, SemaphoreProvider as c, wasmCallWrapper as i, warmupWasm as n, IdCaptureModelType as o, mlWasmJSApi_default as r, loadWasmModule as s, BaseWasmProvider as t };
1080
+ export { enableWasmEncryption as a, setWebApiHttpTransport as c, IdCaptureModelType as d, WasmWebClientError as i, setupWasmConnection as l, warmupWasm as n, executeWasmRequest as o, mlWasmJSApi_default as r, initializeWasmWebClient as s, BaseWasmProvider as t, WasmPipelineType as u };
@@ -1,4 +1,4 @@
1
- import { r as mlWasmJSApi_default, t as BaseWasmProvider } from "./BaseWasmProvider-IiHnsP8E.esm.js";
1
+ import { r as mlWasmJSApi_default, t as BaseWasmProvider } from "./BaseWasmProvider-rCpBxg2n.esm.js";
2
2
 
3
3
  //#region ../infra/src/providers/wasm/WasmUtilProvider.ts
4
4
  var WasmUtilProvider = class WasmUtilProvider extends BaseWasmProvider {
@@ -1,6 +1,6 @@
1
1
  import { t as Manager } from "./Manager-D9pehGyp.js";
2
2
  import "./Actor-YjWTo26u.js";
3
- import { a as AE_CONSENT_KEYS, c as ConsentKey, g as getDefaultConsentChecks, i as electronicSignatureMachine, l as ElectronicSignatureConfig, m as areAllConsented, n as ElectronicSignatureState, s as ConsentChecks, u as ElectronicSignatureDocument } from "./index-BRdxM5zm.js";
3
+ import { a as AE_CONSENT_KEYS, c as ConsentKey, g as getDefaultConsentChecks, i as electronicSignatureMachine, l as ElectronicSignatureConfig, m as areAllConsented, n as ElectronicSignatureState, s as ConsentChecks, u as ElectronicSignatureDocument } from "./index-CRvEjMgP.js";
4
4
 
5
5
  //#region src/modules/ae-signature/index.d.ts
6
6
 
@@ -1,12 +1,12 @@
1
- import "./warmup-DHGg8wQZ.js";
1
+ import "./warmup-C6O7yhfX.js";
2
2
  import "./Manager-D9pehGyp.js";
3
3
  import "./Actor-YjWTo26u.js";
4
4
  import "./StateMachine-CJG7thvx.js";
5
- import { _ as AuthenticationConfig, b as authenticationMachine, g as createAuthenticationActor, h as CreateAuthenticationActorOptions, m as AuthenticationActor } from "./faceCaptureManagerFactory-FX5Lw2Q5.js";
5
+ import { _ as AuthenticationConfig, b as authenticationMachine, g as createAuthenticationActor, h as CreateAuthenticationActorOptions, m as AuthenticationActor } from "./faceCaptureManagerFactory-DmHbKbyC.js";
6
6
  import "./camera-B6UAKpM1.js";
7
7
  import "./types-DJSt3Ovt.js";
8
- import "./types-BA181GDD.js";
9
- import "./deepsightService-CGSDjjBz.js";
8
+ import "./types-DkXZpS0R.js";
9
+ import "./deepsightService-Kuw9roIJ.js";
10
10
  import "./types-CarMMtoz.js";
11
- import { n as AuthenticationState, r as createAuthenticationManager, t as AuthenticationManager } from "./authenticationManager-BuChl5GH.js";
11
+ import { n as AuthenticationState, r as createAuthenticationManager, t as AuthenticationManager } from "./authenticationManager-BnltMEfq.js";
12
12
  export { type AuthenticationActor, type AuthenticationConfig, type AuthenticationManager, type AuthenticationState, type CreateAuthenticationActorOptions, authenticationMachine, createAuthenticationActor, createAuthenticationManager };
@@ -1,25 +1,25 @@
1
- import "./BaseWasmProvider-IiHnsP8E.esm.js";
2
- import "./WasmUtilProvider-BrEYcdhY.esm.js";
1
+ import "./BaseWasmProvider-rCpBxg2n.esm.js";
2
+ import "./WasmUtilProvider--NH11WMy.esm.js";
3
3
  import "./api-eqRXuVG-.esm.js";
4
4
  import "./events-Bt1azl2B.esm.js";
5
5
  import "./endpoints-B3V1U9Dg.esm.js";
6
6
  import "./browserSimulation-CAH-V_iE.esm.js";
7
7
  import "./xstate.esm-7GmmAwg6.esm.js";
8
- import "./faceCaptureManagerFactory-ByAGjOLF.esm.js";
8
+ import "./faceCaptureManagerFactory-fu-9hWf5.esm.js";
9
9
  import "./BrowserStorageProvider-CoUfuy0u.esm.js";
10
- import "./recordingService-DMaVUhWY.esm.js";
11
- import "./deepsightService-IxmrmdKl.esm.js";
10
+ import "./faceCaptureSetup-DuyxqX2C.esm.js";
11
+ import "./ITimerCapability-3xSd36bT.esm.js";
12
12
  import "./camera-Bm3wb89Z.esm.js";
13
- import "./getBrowser-Y88tNVud.esm.js";
14
- import "./stats-Bqq9IKre.esm.js";
15
- import "./MotionSensorProvider-DJMsPght.esm.js";
16
- import "./permissionServices-ACBX6sNZ.esm.js";
17
- import "./platform-Dpzd9p3X.esm.js";
18
- import "./ITimerCapability-2pw-S97e.esm.js";
19
- import "./backCameraStream-DWZ1cNVA.esm.js";
20
- import "./getDeviceClass-DmoqR7G2.esm.js";
21
- import "./faceCaptureSetup-CUzqUwkP.esm.js";
22
- import { t as authenticationMachine } from "./authenticationStateMachine-BNs4VCxh.esm.js";
23
- import { r as createAuthenticationActor, t as createAuthenticationManager } from "./authenticationManager-CKDxnLtG.esm.js";
13
+ import "./deepsightService-Dv6kvzph.esm.js";
14
+ import "./recordingService-D7oQbN6c.esm.js";
15
+ import "./platform-CDh4uv5Y.esm.js";
16
+ import "./backCameraStream-BKC7QXRJ.esm.js";
17
+ import "./getBrowser-Bl0PlyDu.esm.js";
18
+ import "./stats-qUsejORa.esm.js";
19
+ import "./getDeviceClass-C1ZS2XJL.esm.js";
20
+ import "./MotionSensorProvider-Dt_lF3Z8.esm.js";
21
+ import "./permissionServices-Cdxqlwqz.esm.js";
22
+ import { t as authenticationMachine } from "./authenticationStateMachine-BkxEuiOe.esm.js";
23
+ import { r as createAuthenticationActor, t as createAuthenticationManager } from "./authenticationManager-DcGiJ5zB.esm.js";
24
24
 
25
25
  export { authenticationMachine, createAuthenticationActor, createAuthenticationManager };
@@ -1,5 +1,5 @@
1
1
  import { t as Manager } from "./Manager-D9pehGyp.js";
2
- import { h as CreateAuthenticationActorOptions, m as AuthenticationActor, n as FaceCaptureManagerState, t as FaceCaptureManager } from "./faceCaptureManagerFactory-FX5Lw2Q5.js";
2
+ import { h as CreateAuthenticationActorOptions, m as AuthenticationActor, n as FaceCaptureManagerState, t as FaceCaptureManager } from "./faceCaptureManagerFactory-DmHbKbyC.js";
3
3
 
4
4
  //#region src/modules/authentication/authenticationManager.d.ts
5
5
  type AuthenticationState = FaceCaptureManagerState;
@@ -1,9 +1,9 @@
1
- import { t as WasmUtilProvider } from "./WasmUtilProvider-BrEYcdhY.esm.js";
1
+ import { t as WasmUtilProvider } from "./WasmUtilProvider--NH11WMy.esm.js";
2
2
  import { n as eventModuleNames } from "./events-Bt1azl2B.esm.js";
3
3
  import { o as createActor } from "./xstate.esm-7GmmAwg6.esm.js";
4
- import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-ByAGjOLF.esm.js";
4
+ import { t as createFaceCaptureManagerFromActor } from "./faceCaptureManagerFactory-fu-9hWf5.esm.js";
5
5
  import { t as BrowserStorageProvider } from "./BrowserStorageProvider-CoUfuy0u.esm.js";
6
- import { t as authenticationMachine } from "./authenticationStateMachine-BNs4VCxh.esm.js";
6
+ import { t as authenticationMachine } from "./authenticationStateMachine-BkxEuiOe.esm.js";
7
7
 
8
8
  //#region src/modules/authentication/authenticationActor.ts
9
9
  function createAuthenticationActor(options) {
@@ -1,9 +1,9 @@
1
1
  import { t as api } from "./api-eqRXuVG-.esm.js";
2
2
  import { t as endpoints } from "./endpoints-B3V1U9Dg.esm.js";
3
3
  import { a as fromPromise, r as assign } from "./xstate.esm-7GmmAwg6.esm.js";
4
- import { v as FACE_ERROR_CODES } from "./recordingService-DMaVUhWY.esm.js";
5
- import { t as getDeviceClass } from "./getDeviceClass-DmoqR7G2.esm.js";
6
- import { t as faceCaptureMachine } from "./faceCaptureSetup-CUzqUwkP.esm.js";
4
+ import { a as prepareOnDeviceFaceUpload, i as postOnDeviceFaceResults, n as defaultPrepareFaceUpload, r as isOnDeviceMode, t as faceCaptureMachine } from "./faceCaptureSetup-DuyxqX2C.esm.js";
5
+ import { m as FACE_ERROR_CODES } from "./recordingService-D7oQbN6c.esm.js";
6
+ import { t as getDeviceClass } from "./getDeviceClass-C1ZS2XJL.esm.js";
7
7
 
8
8
  //#region src/modules/authentication/authenticationErrorUtils.ts
9
9
  const AUTH_ERROR_MAP = {
@@ -79,8 +79,13 @@ const getAuthErrorCodeFromHttpError = (error) => {
79
79
  //#region src/modules/authentication/authenticationStateMachine.ts
80
80
  const _authenticationMachine = faceCaptureMachine.provide({
81
81
  actors: {
82
+ prepareFaceUpload: fromPromise(async ({ input }) => {
83
+ const ctx = input;
84
+ return isOnDeviceMode(ctx.config) ? prepareOnDeviceFaceUpload(ctx) : defaultPrepareFaceUpload(ctx);
85
+ }),
82
86
  uploadFace: fromPromise(async ({ input, signal }) => {
83
87
  const ctx = input;
88
+ if (isOnDeviceMode(ctx.config)) return postOnDeviceFaceResults(ctx, signal);
84
89
  return uploadAuthFace({
85
90
  encryptedBase64Image: ctx.encryptedBase64Image,
86
91
  faceCoordinates: ctx.faceCoordinates,
@@ -94,6 +99,7 @@ const _authenticationMachine = faceCaptureMachine.provide({
94
99
  },
95
100
  actions: {
96
101
  setUploadErrorFromUploadValidation: assign({ uploadError: ({ context }) => {
102
+ if (isOnDeviceMode(context.config)) return;
97
103
  const resp = context.uploadResponse;
98
104
  return validateAuthUploadResponse(resp) ?? FACE_ERROR_CODES.SERVER;
99
105
  } }),
@@ -115,10 +121,12 @@ const _authenticationMachine = faceCaptureMachine.provide({
115
121
  },
116
122
  guards: {
117
123
  hasUploadValidationError: ({ context }) => {
124
+ if (isOnDeviceMode(context.config)) return false;
118
125
  const resp = context.uploadResponse;
119
126
  return validateAuthUploadResponse(resp) !== void 0;
120
127
  },
121
128
  isTerminalUploadError: ({ context }) => {
129
+ if (isOnDeviceMode(context.config)) return false;
122
130
  const resp = context.uploadResponse;
123
131
  return isTerminalAuthError(resp, context.attemptsRemaining);
124
132
  },
@@ -1,6 +1,6 @@
1
+ import { t as sleep } from "./ITimerCapability-3xSd36bT.esm.js";
1
2
  import { i as stopCameraStream, n as enumerateVideoDevices, r as requestCameraAccess, t as applyTrackConstraints } from "./camera-Bm3wb89Z.esm.js";
2
- import { a as isIPhone14OrHigher, o as isSafari, r as isIOS, t as isAndroid } from "./platform-Dpzd9p3X.esm.js";
3
- import { t as sleep } from "./ITimerCapability-2pw-S97e.esm.js";
3
+ import { a as isIPhone14OrHigher, o as isSafari, r as isIOS, t as isAndroid } from "./platform-CDh4uv5Y.esm.js";
4
4
 
5
5
  //#region src/internal/camera/backCameraStream.ts
6
6
  const BACK_CAMERA_KEYWORDS = [
@@ -1,5 +1,5 @@
1
1
  import "./camera-Bm3wb89Z.esm.js";
2
- import "./MotionSensorProvider-DJMsPght.esm.js";
3
- import { n as requestPermission, t as checkPermission } from "./permissionServices-ACBX6sNZ.esm.js";
2
+ import "./MotionSensorProvider-Dt_lF3Z8.esm.js";
3
+ import { n as requestPermission, t as checkPermission } from "./permissionServices-Cdxqlwqz.esm.js";
4
4
 
5
5
  export { checkPermission as checkCameraPermission, requestPermission as requestCameraPermission };