@sekyro/web 0.1.0-rc.21 → 0.1.0-rc.23
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/CHANGELOG.md +53 -0
- package/README.md +12 -11
- package/dist/camera-trait-V4UAOPIQ.js +1 -0
- package/dist/{capture-constraints-B5omafmk.d.cts → capture-constraints-CVqpMNGA.d.cts} +7 -3
- package/dist/{capture-constraints-B5omafmk.d.ts → capture-constraints-CVqpMNGA.d.ts} +7 -3
- package/dist/{capture-session-doc-XBZGXWOP.js → capture-session-doc-BBDKMEAP.js} +1 -1
- package/dist/{capture-session-v3-ZO0QOeQH.d.ts → capture-session-v3-CFXYS0Pg.d.cts} +90 -13
- package/dist/{capture-session-v3-26FgzBIl.d.cts → capture-session-v3-DID39wUZ.d.ts} +90 -13
- package/dist/chunk-2LDOXGY3.js +1 -0
- package/dist/chunk-5DTWBDCP.js +1 -0
- package/dist/chunk-72LG73YL.js +1 -0
- package/dist/chunk-7QZWBDI5.js +1 -0
- package/dist/chunk-CPUECYAJ.js +1 -0
- package/dist/chunk-FSSMUAKC.js +1 -0
- package/dist/chunk-JWEHH2MS.js +1 -0
- package/dist/chunk-JYU5YHXN.js +1 -0
- package/dist/chunk-LFMIFR6T.js +1 -0
- package/dist/chunk-LJYMZQY2.js +1 -0
- package/dist/chunk-PBLZ5W7P.js +1 -0
- package/dist/chunk-RPVI2OGR.js +1 -0
- package/dist/chunk-SX7TUC3V.js +1 -0
- package/dist/chunk-TSA6GHUG.js +1 -0
- package/dist/chunk-U3NYGTX7.js +1 -0
- package/dist/chunk-VWGKUQ3C.js +1 -0
- package/dist/chunk-X6UIO5E3.js +1 -0
- package/dist/{chunk-QYYJLXKA.js → chunk-YWGW63B3.js} +1 -1
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +1 -1
- package/dist/clip-inspect-DLJXVKV6.js +1 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +5 -5
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +1 -1
- package/dist/core/v3/detect-worker.cjs +1 -1
- package/dist/core/v3/detect-worker.d.cts +1 -1
- package/dist/core/v3/detect-worker.d.ts +1 -1
- package/dist/core/v3/detect-worker.js +1 -1
- package/dist/create-document-capture-K5PDVOGV.js +1 -0
- package/dist/create-portrait-capture-5VGYZUOK.js +1 -0
- package/dist/{create-verification-KlHIU4Fy.d.ts → create-verification-BP2L4rzV.d.cts} +201 -82
- package/dist/{create-verification-CXhXxknV.d.cts → create-verification-Dc1Rd-4T.d.ts} +201 -82
- package/dist/{detect-worker-DclNxkZT.d.cts → detect-worker-CHqsPJoM.d.cts} +19 -2
- package/dist/{detect-worker-DclNxkZT.d.ts → detect-worker-CHqsPJoM.d.ts} +19 -2
- package/dist/{icao-gate-DI8VePWd.d.ts → icao-gate-CIXjbPCL.d.cts} +8 -1
- package/dist/{icao-gate-DvzOzHq6.d.cts → icao-gate-COt4O4h_.d.ts} +8 -1
- package/dist/{icao-policy-MRB8NMAu.d.cts → icao-policy-Cizs5guu.d.cts} +2 -2
- package/dist/{icao-policy-DztbA50-.d.ts → icao-policy-DI4kU6Mv.d.ts} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +11 -15
- package/dist/index.d.ts +11 -15
- package/dist/index.js +1 -1
- package/dist/internal/index.cjs +1 -1
- package/dist/internal/index.d.cts +49 -34
- package/dist/internal/index.d.ts +49 -34
- package/dist/internal/index.js +1 -1
- package/dist/plan-runner-AD2JTMC7.js +1 -0
- package/dist/popup/index.cjs +1 -1
- package/dist/popup/index.d.cts +2 -2
- package/dist/popup/index.d.ts +2 -2
- package/dist/popup/index.js +1 -1
- package/dist/{print-AYSCRSZB.js → print-SEWS3VHQ.js} +1 -1
- package/dist/{turnstile-FATNZ4AG.js → turnstile-F4DS2L3F.js} +1 -1
- package/dist/{types-C_XP92JQ.d.cts → types-Cjnp1o8i.d.cts} +161 -84
- package/dist/{types-C_XP92JQ.d.ts → types-Cjnp1o8i.d.ts} +161 -84
- package/package.json +1 -1
- package/sbom.cdx.json +10 -10
- package/dist/camera-trait-45MJTW4K.js +0 -1
- package/dist/chunk-234OZEDB.js +0 -1
- package/dist/chunk-7Q4YPMAF.js +0 -1
- package/dist/chunk-B2X33ZW2.js +0 -1
- package/dist/chunk-CQ7SKLMC.js +0 -1
- package/dist/chunk-FUHDOEBP.js +0 -1
- package/dist/chunk-GT2ZLGF7.js +0 -1
- package/dist/chunk-H3HVCWLF.js +0 -1
- package/dist/chunk-O5WKNZ2C.js +0 -1
- package/dist/chunk-OKWG3PVH.js +0 -1
- package/dist/chunk-P3H3D33O.js +0 -1
- package/dist/chunk-P6UP4UQY.js +0 -1
- package/dist/chunk-SNACCYTL.js +0 -1
- package/dist/chunk-TQB3URP2.js +0 -1
- package/dist/chunk-VIAT4DEA.js +0 -1
- package/dist/chunk-ZADZTM3M.js +0 -1
- package/dist/chunk-ZNIZACXD.js +0 -1
- package/dist/create-document-capture-23R2F47A.js +0 -1
- package/dist/create-portrait-capture-AGFHECK7.js +0 -1
- package/dist/plan-runner-NUWONT7F.js +0 -1
|
@@ -243,19 +243,37 @@ declare const ICAO_FALLBACK: Omit<ResolvedIcaoTuning, "tuningVersion">;
|
|
|
243
243
|
*/
|
|
244
244
|
declare function resolveIcaoTuning(raw: unknown, tuningVersion?: unknown): ResolvedIcaoTuning;
|
|
245
245
|
|
|
246
|
-
/** Session lifecycle status (spec §4 two-field status/outcome model). */
|
|
247
|
-
type SessionStatus = "created" | "in_progress" | "review_pending" | "completed" | "expired" | "failed";
|
|
248
246
|
/**
|
|
249
|
-
*
|
|
250
|
-
* `
|
|
251
|
-
*
|
|
252
|
-
* failed with `superseded_by_retry`, and the verdict is on the newer session.
|
|
247
|
+
* Session lifecycle status (session outcome model 2026-11-08): a finished session is
|
|
248
|
+
* `verified` or `not_verified`; a `not_verified` one says why in {@link SessionReason},
|
|
249
|
+
* and every finished one says who or what closed it in {@link ClosedBy}.
|
|
253
250
|
*/
|
|
254
|
-
type
|
|
251
|
+
type SessionStatus = "created" | "in_progress" | "review_pending" | "verified" | "not_verified";
|
|
252
|
+
/**
|
|
253
|
+
* Why a `not_verified` session was not verified (verification-session.schema.ts
|
|
254
|
+
* `SESSION_REASONS`): a verdict against the person (`rejected`), no verdict
|
|
255
|
+
* (`inconclusive`), the check could not run (`unavailable`), the person left before a
|
|
256
|
+
* result (`abandoned`), nobody opened the link (`not_opened`), a flow rule (`policy`),
|
|
257
|
+
* the organization cancelled it (`cancelled`), a newer session took its review over
|
|
258
|
+
* (`superseded`).
|
|
259
|
+
*/
|
|
260
|
+
type SessionReason = "rejected" | "inconclusive" | "unavailable" | "abandoned" | "not_opened" | "policy" | "cancelled" | "superseded";
|
|
261
|
+
/** Who or what closed a finished session (verification-session.schema.ts `CLOSED_BY`). */
|
|
262
|
+
type ClosedBy = "automatic" | "reviewer" | "deadline" | "expiry" | "organization";
|
|
263
|
+
/**
|
|
264
|
+
* What a step's last counted attempt said (verification-session.schema.ts `STEP_RESULTS`);
|
|
265
|
+
* absent before the first counted attempt.
|
|
266
|
+
*/
|
|
267
|
+
type StepResult = "passed" | "rejected" | "inconclusive" | "unreadable" | "unavailable" | "review";
|
|
268
|
+
/** The step that decided a `not_verified` session: its node id and its service. */
|
|
269
|
+
interface SessionDecidingStep {
|
|
270
|
+
id: string;
|
|
271
|
+
service: string;
|
|
272
|
+
}
|
|
255
273
|
/**
|
|
256
274
|
* What a finished session proved (spec 2026-10-29 §3.2): `1` a live, real
|
|
257
275
|
* person, `2` that person's identity, `3` an identity corroborated by an
|
|
258
|
-
* independent source; `0` on a
|
|
276
|
+
* independent source; `0` on a `not_verified` session.
|
|
259
277
|
*/
|
|
260
278
|
type VerificationLevel = 0 | 1 | 2 | 3;
|
|
261
279
|
/** How a session's {@link VerificationLevel} was proved (spec 2026-10-29 §3.4). */
|
|
@@ -269,9 +287,9 @@ type CheckState = "pending" | "input_required" | "processing" | "passed" | "fail
|
|
|
269
287
|
* `eid_auth` (SDK spec §3.2) is the national eID sign-in (Houwiyeti in MR).
|
|
270
288
|
*/
|
|
271
289
|
type CheckType = "liveness" | "face_match" | "doc_ocr" | "population_registry" | "phone_otp" | "nfc_chip" | "email_otp" | "portrait_icao" | "eid_auth";
|
|
272
|
-
type LivenessReason = "no_face" | "media_unreadable" | "clip_too_short" | "spoof_detected" | "review_band" | "liveness_inconclusive" | "device_integrity_failed" | "mobile_required" | "
|
|
273
|
-
type PopulationReason = "registry_record_not_found" | "nni_not_found" | "id_number_invalid" | "nni_invalid" | "registry_unavailable" | "
|
|
274
|
-
type FaceMatchReason = "no_face_source" | "no_face_reference" | "low_quality_reference" | "below_threshold" | "review_band" | "match_inconclusive" | "subject_revoked" | "probe_not_from_liveness" | "prior_review_approved"
|
|
290
|
+
type LivenessReason = "no_face" | "media_unreadable" | "clip_too_short" | "spoof_detected" | "review_band" | "liveness_inconclusive" | "device_integrity_failed" | "mobile_required" | "capture_back_camera" | "capture_not_upright" | "capture_front_camera" | "multiple_faces" | "camera_unavailable";
|
|
291
|
+
type PopulationReason = "registry_record_not_found" | "nni_not_found" | "id_number_invalid" | "nni_invalid" | "registry_unavailable" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "id_number_recheck" | "nni_recheck";
|
|
292
|
+
type FaceMatchReason = "no_face_source" | "no_face_reference" | "low_quality_reference" | "below_threshold" | "review_band" | "match_inconclusive" | "subject_revoked" | "probe_not_from_liveness" | "prior_review_approved";
|
|
275
293
|
type DocReason = "side_missing" | "mrz_checksum_failed" | "unreadable" | "expired_document" | "authenticity_review" | "document_authenticity" | "registry_mismatch" | "document_id_number_mismatch" | "document_nni_mismatch" | "nationality_unreadable" | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "document_number_mismatch";
|
|
276
294
|
/**
|
|
277
295
|
* Profile v2 step 3 matching reasons: a field the partner sent at session
|
|
@@ -306,7 +324,7 @@ type EmailOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_
|
|
|
306
324
|
/**
|
|
307
325
|
* nfc_chip reasons (M-nfc, SDK spec §4.3). Native SDKs read the chip; the web
|
|
308
326
|
* never does — on web the step arrives `skipped` (`platform_unsupported`) or
|
|
309
|
-
* the session shows `
|
|
327
|
+
* the session shows `reasonCode: 'platform_unsupported'`.
|
|
310
328
|
*/
|
|
311
329
|
type NfcChipReason = "chip_read_failed" | "chip_access_denied" | "chip_parse_failed" | "chip_not_present" | "nfc_unavailable" | "chip_document_mismatch" | "chip_integrity_failed" | "registry_mismatch" | "document_id_number_mismatch" | "document_nni_mismatch" | "platform_unsupported";
|
|
312
330
|
/**
|
|
@@ -343,12 +361,19 @@ type CheckReason = LivenessReason | PopulationReason | FaceMatchReason | DocReas
|
|
|
343
361
|
*/
|
|
344
362
|
| "tester_document_mismatch" | "tester_phone_mismatch"
|
|
345
363
|
/**
|
|
346
|
-
* Review
|
|
347
|
-
*
|
|
348
|
-
* `superseded`) and `review_split` (two reviewers disagreed and nobody
|
|
349
|
-
*
|
|
364
|
+
* Review ends, on any reviewed step: `superseded_by_retry` (a newer attempt of the
|
|
365
|
+
* same person took the review over; the session is `not_verified` with reason
|
|
366
|
+
* `superseded`) and `review_split` (two reviewers disagreed and nobody settled it
|
|
367
|
+
* before the review deadline; the session is `not_verified` with reason `inconclusive`).
|
|
350
368
|
*/
|
|
351
|
-
| "superseded_by_retry" | "review_split"
|
|
369
|
+
| "superseded_by_retry" | "review_split"
|
|
370
|
+
/**
|
|
371
|
+
* Session outcome model §2.4: `review_timeout` (the review deadline passed, written on the
|
|
372
|
+
* reviewed step; the session is `not_verified` with reason `inconclusive`) and
|
|
373
|
+
* `inference_unavailable` (the model service could not run the check; the step's `result`
|
|
374
|
+
* is `unavailable`).
|
|
375
|
+
*/
|
|
376
|
+
| "review_timeout" | "inference_unavailable";
|
|
352
377
|
/**
|
|
353
378
|
* Session-level failure reasons: the session was stopped by a policy gate,
|
|
354
379
|
* not by a failed check. All are terminal (no retry on this session):
|
|
@@ -366,13 +391,6 @@ type CheckReason = LivenessReason | PopulationReason | FaceMatchReason | DocReas
|
|
|
366
391
|
* - `blocked_by_org`: one of the organization's blocks stopped the session.
|
|
367
392
|
*/
|
|
368
393
|
type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown" | "platform_unsupported" | "blocked_by_org" | "starter_credit_claimed";
|
|
369
|
-
/**
|
|
370
|
-
* The profile-v2 policy reasons a session can end on: the two session-level
|
|
371
|
-
* reasons plus the failed check's policy reasons (`document_type_not_accepted`,
|
|
372
|
-
* `nationality_not_allowed`, `underage`, `age_unverifiable`,
|
|
373
|
-
* `document_id_number_mismatch`, formerly `document_nni_mismatch`).
|
|
374
|
-
*/
|
|
375
|
-
type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "document_id_number_mismatch" | "document_nni_mismatch" | "camera_unavailable" | "underage_estimated";
|
|
376
394
|
/**
|
|
377
395
|
* Why the person has no camera (spec 2026-10-29 §3.4, 2026-10-30): `denied` when the camera permission was refused,
|
|
378
396
|
* `no_camera` when there is no usable camera (none found, an insecure page or a browser that cannot capture).
|
|
@@ -646,7 +664,7 @@ interface HostedEmailOtpView {
|
|
|
646
664
|
* criterion; every one is retryable (re-run only the ICAO gate).
|
|
647
665
|
* `media_unreadable` (no report) is shared with liveness.
|
|
648
666
|
*/
|
|
649
|
-
type PortraitIcaoReason = "icao_pose" | "icao_eyes" | "icao_mouth" | "icao_occlusion" | "icao_lighting" | "icao_background" | "icao_resolution" | "portrait_not_from_liveness" | "portrait_morph_suspected" | "portrait_reference_mismatch" | "portrait_declined_fix" | "portrait_fix_review";
|
|
667
|
+
type PortraitIcaoReason = "icao_pose" | "icao_eyes" | "icao_mouth" | "icao_occlusion" | "icao_lighting" | "icao_background" | "icao_resolution" | "portrait_not_from_liveness" | "portrait_morph_suspected" | "portrait_reference_mismatch" | "portrait_declined_fix" | "portrait_fix_review" | "capture_front_camera";
|
|
650
668
|
/** One ICAO criterion of the server's portrait report (SDK spec §4.9). */
|
|
651
669
|
type IcaoCriterion = "pose" | "eyes" | "mouth" | "occlusion" | "glare" | "lighting" | "background" | "resolution";
|
|
652
670
|
/** The ICAO policy of a session's selfie (spec 2026-10-24 selfie ICAO policy §10). */
|
|
@@ -759,6 +777,8 @@ interface HostedStepView {
|
|
|
759
777
|
state: CheckState;
|
|
760
778
|
/** Frozen-taxonomy reason code explaining a `failed`/`review` state. */
|
|
761
779
|
reason?: CheckReason;
|
|
780
|
+
/** What the last counted attempt said ({@link StepResult}); absent before the first one. */
|
|
781
|
+
result?: StepResult;
|
|
762
782
|
/**
|
|
763
783
|
* Liveness v7 §5.2: what to change for the next capture, on a liveness step parked at
|
|
764
784
|
* `input_required` (the signal that weighed most in the inconclusive score). Absent on older
|
|
@@ -782,11 +802,8 @@ interface HostedStepView {
|
|
|
782
802
|
otp?: HostedOtpView;
|
|
783
803
|
/** email_otp only: the display-safe email send surface (never the handle or the address). */
|
|
784
804
|
emailOtp?: HostedEmailOtpView;
|
|
785
|
-
/**
|
|
786
|
-
|
|
787
|
-
* Absent on older APIs (treat absent as `false`).
|
|
788
|
-
*/
|
|
789
|
-
attemptsExhausted?: boolean;
|
|
805
|
+
/** Counted attempts and the cap (`used >= max`: no try is left). */
|
|
806
|
+
attempts?: PlanAttempts;
|
|
790
807
|
/**
|
|
791
808
|
* population_registry only: the session is not bound to an NNI, but the
|
|
792
809
|
* document step already read a valid one — the page submits the registry
|
|
@@ -814,11 +831,10 @@ interface HostedStepView {
|
|
|
814
831
|
/** phone_otp only (phone rules spec §2.1): numbers from other countries are accepted, through a free international field. */
|
|
815
832
|
phoneInternational?: true;
|
|
816
833
|
/**
|
|
817
|
-
*
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
* Absent on older APIs and in `review` mode.
|
|
834
|
+
* Spec 2026-11-06 §3.1: the step's camera runs on a phone only, in every decision mode. Set on `liveness` and
|
|
835
|
+
* `face_match`, and on `doc_ocr` / `portrait_icao` whose photo source is `camera` or `choice` (under `choice` the
|
|
836
|
+
* upload stays on the desktop). A desktop page hands the camera over to a phone instead of opening the webcam; a
|
|
837
|
+
* camera capture from a desktop answers `409 mobile_required`. Absent on `upload` steps and steps without a camera.
|
|
822
838
|
*/
|
|
823
839
|
requiresMobile?: boolean;
|
|
824
840
|
/** nfc_chip only (M-nfc). */
|
|
@@ -921,12 +937,18 @@ interface HostedCaptureTuning {
|
|
|
921
937
|
* Who films the face, set in the flow (always present on current backends):
|
|
922
938
|
* - `self` — the person films themselves: front camera only, no camera
|
|
923
939
|
* choice, phone held upright;
|
|
924
|
-
* - `assisted` —
|
|
925
|
-
*
|
|
940
|
+
* - `assisted` — another person films the person: back camera only, phone
|
|
941
|
+
* held upright.
|
|
926
942
|
* `@sekyro/web` enforces it on a capture bound to the session; an absent
|
|
927
943
|
* value falls back to {@link HostedCaptureTuning.cameraSwitch}, then `self`.
|
|
928
944
|
*/
|
|
929
945
|
mode?: CaptureMode;
|
|
946
|
+
/**
|
|
947
|
+
* Spec 2026-11-06 §3.4, under `mode: 'choice'` only: the latest mode a camera attempt of this session ran in
|
|
948
|
+
* (`self` / `assisted`). Open the camera in it (a reloaded page), with the switch still offered. Absent before the
|
|
949
|
+
* first attempt and on older servers.
|
|
950
|
+
*/
|
|
951
|
+
pick?: ResolvedCaptureMode;
|
|
930
952
|
/**
|
|
931
953
|
* @deprecated Mirror of `mode === 'assisted'`, kept for older clients. Read
|
|
932
954
|
* {@link HostedCaptureTuning.mode}.
|
|
@@ -936,8 +958,9 @@ interface HostedCaptureTuning {
|
|
|
936
958
|
/**
|
|
937
959
|
* Who films the face (`HostedSessionView.capture.mode`, a flow setting):
|
|
938
960
|
* `self` (the person, front camera), `assisted` (an agent, back camera) or
|
|
939
|
-
* `choice` (the
|
|
940
|
-
*
|
|
961
|
+
* `choice` (the liveness camera opens in `self` and the person can switch to
|
|
962
|
+
* `assisted` and back on the camera view; each attempt runs in one
|
|
963
|
+
* {@link ResolvedCaptureMode}).
|
|
941
964
|
*/
|
|
942
965
|
type CaptureMode = "self" | "assisted" | "choice";
|
|
943
966
|
/** The mode a camera runs in: the session's {@link CaptureMode}, or the person's pick under `choice`. */
|
|
@@ -962,23 +985,31 @@ interface HostedLivenessCaptureTuning {
|
|
|
962
985
|
*/
|
|
963
986
|
screenRamp?: ScreenRampChallenge;
|
|
964
987
|
}
|
|
988
|
+
/** A screen-ramp palette colour (ramp v2: four saturated colours). */
|
|
989
|
+
type ScreenRampColour = 'magenta' | 'yellow' | 'green' | 'blue';
|
|
990
|
+
/** What the screen-ramp layer shows: a palette colour, `'dark'` (black, the dark-gap arm) or `null` (cleared). */
|
|
991
|
+
type ScreenRampPaint = ScreenRampColour | 'dark' | null;
|
|
965
992
|
/**
|
|
966
|
-
* The
|
|
967
|
-
*
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
*
|
|
972
|
-
* starting at `onsetsMs[i]` on the clip's own timeline (the backend jitters each onset inside its slot). The layer
|
|
973
|
-
* returns to transparent at 2,000 ms. The client renders exactly this and reports what it rendered
|
|
974
|
-
* ({@link ScreenRampReport}); the backend forwards the issued challenge to the model service.
|
|
993
|
+
* The screen-ramp challenge issued per session (ramp v2; liveness v7 §4.4, §4.5 item 1): the client paints the whole
|
|
994
|
+
* screen `colours[i]` from `onsetsMs[i]` on the clip's own timeline for `holdMs` (black for the rest of the slot when
|
|
995
|
+
* that is shorter than the gap to the next onset), clears it at `endMs`, and records at least `clipMs`. The backend
|
|
996
|
+
* issues three distinct colours in 650 ms slots after an 800 to 850 ms settle, and a 3.0 s clip. The
|
|
997
|
+
* client renders exactly this and reports what it rendered ({@link ScreenRampReport}); the backend forwards the issued
|
|
998
|
+
* challenge to the model service, which reads the order of the colours the face took.
|
|
975
999
|
*/
|
|
976
1000
|
interface ScreenRampChallenge {
|
|
977
1001
|
/** Ties the report to the issued challenge (echoed in {@link ScreenRampReport.nonce}). */
|
|
978
1002
|
nonce: string;
|
|
979
|
-
colours
|
|
980
|
-
|
|
981
|
-
|
|
1003
|
+
/** One to eight palette colours (the backend issues five). */
|
|
1004
|
+
colours: ScreenRampColour[];
|
|
1005
|
+
/** Ms on the clip timeline, strictly ascending, one per colour. */
|
|
1006
|
+
onsetsMs: number[];
|
|
1007
|
+
/** How long each colour shows from its onset (ms). */
|
|
1008
|
+
holdMs: number;
|
|
1009
|
+
/** The layer clears here (ms on the clip timeline). */
|
|
1010
|
+
endMs: number;
|
|
1011
|
+
/** The clip records at least this long (ms, at most 8,000). */
|
|
1012
|
+
clipMs: number;
|
|
982
1013
|
/** The palette the colours were drawn from (informational; the client renders `colours`). */
|
|
983
1014
|
palette: ScreenRampColour[];
|
|
984
1015
|
}
|
|
@@ -990,7 +1021,7 @@ interface ScreenRampRendered {
|
|
|
990
1021
|
/** `LivenessCaptureInput.screenRamp`: what the SDK rendered against the issued {@link ScreenRampChallenge}. */
|
|
991
1022
|
interface ScreenRampReport {
|
|
992
1023
|
nonce: string;
|
|
993
|
-
/** In render order, at most
|
|
1024
|
+
/** In render order, one per painted colour (never the dark gap), at most one per issued colour. */
|
|
994
1025
|
rendered: ScreenRampRendered[];
|
|
995
1026
|
}
|
|
996
1027
|
/**
|
|
@@ -1103,7 +1134,19 @@ interface HostedIntegrity {
|
|
|
1103
1134
|
interface HostedSessionView {
|
|
1104
1135
|
sessionId: string;
|
|
1105
1136
|
status: SessionStatus;
|
|
1106
|
-
|
|
1137
|
+
/** `not_verified` only: why ({@link SessionReason}). */
|
|
1138
|
+
reason?: SessionReason;
|
|
1139
|
+
/**
|
|
1140
|
+
* The detailed code behind `reason`, when one exists (`spoof_detected`, `match_inconclusive`,
|
|
1141
|
+
* `device_cooldown`, ...). Also a stop the page shows on a session that stays open:
|
|
1142
|
+
* `platform_unsupported` (a required chip read this client cannot do) and
|
|
1143
|
+
* `starter_credit_claimed` (an owner check of a person who already earned the credit).
|
|
1144
|
+
*/
|
|
1145
|
+
reasonCode?: string;
|
|
1146
|
+
/** Finished sessions: who or what closed it ({@link ClosedBy}). */
|
|
1147
|
+
closedBy?: ClosedBy;
|
|
1148
|
+
/** `not_verified` only: the step that decided it, when one did. */
|
|
1149
|
+
step?: SessionDecidingStep;
|
|
1107
1150
|
/** ISO-8601 timestamp (Date on the server, string on the wire). */
|
|
1108
1151
|
expiresAt: string;
|
|
1109
1152
|
consentRecorded: boolean;
|
|
@@ -1121,9 +1164,10 @@ interface HostedSessionView {
|
|
|
1121
1164
|
* Cloudflare Turnstile site key the browser must solve an execute-mode
|
|
1122
1165
|
* challenge against before submitting `liveness` (Plan A Task 5): the org's
|
|
1123
1166
|
* own widget key when the request origin is one of the org's allowlisted SDK
|
|
1124
|
-
* origins, else the hosted widget key
|
|
1125
|
-
*
|
|
1126
|
-
*
|
|
1167
|
+
* origins, else the hosted widget key; on a Sandbox session always
|
|
1168
|
+
* Cloudflare's always-passing test site key, so the same code runs in both
|
|
1169
|
+
* environments. `null` only on a Live deployment without Turnstile: the SDK
|
|
1170
|
+
* sends no token and the server decides.
|
|
1127
1171
|
*/
|
|
1128
1172
|
turnstileSiteKey: string | null;
|
|
1129
1173
|
/**
|
|
@@ -1133,6 +1177,12 @@ interface HostedSessionView {
|
|
|
1133
1177
|
sandbox?: boolean;
|
|
1134
1178
|
/** Spec 2026-10-27: this session enrolls a Sandbox tester (the hosted page shows the removal link at the end). */
|
|
1135
1179
|
testerEnrollment?: boolean;
|
|
1180
|
+
/**
|
|
1181
|
+
* Spec 2026-11-09 §3.3: present only while the flow should offer "Run real checks as a tester" (a simulated Sandbox
|
|
1182
|
+
* session, nothing captured yet, gates left, and the organization has an active tester). `attemptsLeft`: gates left
|
|
1183
|
+
* on this session. Absent in Live and once a tester is recognised (the session then runs real checks).
|
|
1184
|
+
*/
|
|
1185
|
+
testerGate?: HostedTesterGateView;
|
|
1136
1186
|
/**
|
|
1137
1187
|
* The session was minted with a server-bound NNI (`POST /sessions`
|
|
1138
1188
|
* `input.nni`, Plan A Task 2): `population_registry` is submitted with an
|
|
@@ -1157,13 +1207,6 @@ interface HostedSessionView {
|
|
|
1157
1207
|
* the field — treat absent like `null`.
|
|
1158
1208
|
*/
|
|
1159
1209
|
voice?: HostedVoiceView | null;
|
|
1160
|
-
/**
|
|
1161
|
-
* Why the session ended, when a profile-v2 policy stopped it: a
|
|
1162
|
-
* {@link SessionFailureReason}, or the failed check's reason when it is a
|
|
1163
|
-
* policy reason (eligibility, or `document_nni_mismatch`). Absent otherwise
|
|
1164
|
-
* (and on older APIs).
|
|
1165
|
-
*/
|
|
1166
|
-
failureReason?: PolicyFailureReason;
|
|
1167
1210
|
/**
|
|
1168
1211
|
* The document types the person may pick, resolved for issuer `MR`,
|
|
1169
1212
|
* `carte_identite`/`passport` only (older pickers). Absent on older APIs —
|
|
@@ -1183,9 +1226,8 @@ interface HostedSessionView {
|
|
|
1183
1226
|
*/
|
|
1184
1227
|
detectedCountry?: string;
|
|
1185
1228
|
/**
|
|
1186
|
-
* ISO-8601 time from which this device may verify again
|
|
1187
|
-
* `
|
|
1188
|
-
* (and on older APIs).
|
|
1229
|
+
* ISO-8601 time from which this device may verify again, set with
|
|
1230
|
+
* `reasonCode: 'device_cooldown'` (profile v2 step 4). Absent otherwise.
|
|
1189
1231
|
*/
|
|
1190
1232
|
retryAfter?: string;
|
|
1191
1233
|
/**
|
|
@@ -1345,8 +1387,10 @@ interface SessionStepView {
|
|
|
1345
1387
|
*/
|
|
1346
1388
|
simulated?: boolean;
|
|
1347
1389
|
calibratedScore?: number;
|
|
1348
|
-
/**
|
|
1349
|
-
|
|
1390
|
+
/** What the last counted attempt said ({@link StepResult}); absent before the first one. */
|
|
1391
|
+
result?: StepResult;
|
|
1392
|
+
/** Counted attempts and the cap. */
|
|
1393
|
+
attempts?: PlanAttempts;
|
|
1350
1394
|
/** portrait_icao only (SDK spec §4.9): the last attempt's per-criterion report. */
|
|
1351
1395
|
report?: IcaoReportEntry[];
|
|
1352
1396
|
}
|
|
@@ -1357,9 +1401,14 @@ interface SessionStepView {
|
|
|
1357
1401
|
interface SessionView {
|
|
1358
1402
|
id: string;
|
|
1359
1403
|
status: SessionStatus;
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1404
|
+
/** `not_verified` only: why ({@link SessionReason}). */
|
|
1405
|
+
reason?: SessionReason;
|
|
1406
|
+
/** `not_verified` only: the detailed code behind `reason`, when one exists. */
|
|
1407
|
+
reasonCode?: string;
|
|
1408
|
+
/** Finished sessions: who or what closed it ({@link ClosedBy}). */
|
|
1409
|
+
closedBy?: ClosedBy;
|
|
1410
|
+
/** `not_verified` only: the step that decided it, when one did. */
|
|
1411
|
+
step?: SessionDecidingStep;
|
|
1363
1412
|
steps: SessionStepView[];
|
|
1364
1413
|
/** ISO-8601 timestamp (Date on the server, string on the wire). */
|
|
1365
1414
|
expiresAt: string;
|
|
@@ -1427,15 +1476,13 @@ interface CompleteMediaResult {
|
|
|
1427
1476
|
}
|
|
1428
1477
|
/**
|
|
1429
1478
|
* Liveness attestation bag (attestation-verifier.service.ts). The web SDK sends
|
|
1430
|
-
* `{channel: 'hosted_web', siteKey, turnstileToken}`
|
|
1431
|
-
* `HostedSessionView.turnstileSiteKey` the challenge was
|
|
1432
|
-
* backend picks the matching widget secret
|
|
1433
|
-
* are single-use: siteverify runs exactly
|
|
1434
|
-
*
|
|
1435
|
-
* native SDKs will use platform attestation.
|
|
1479
|
+
* `{channel: 'hosted_web', siteKey, turnstileToken}` in both environments:
|
|
1480
|
+
* `siteKey` echoes the `HostedSessionView.turnstileSiteKey` the challenge was
|
|
1481
|
+
* rendered with, so the backend picks the matching widget secret
|
|
1482
|
+
* deterministically (Turnstile tokens are single-use: siteverify runs exactly
|
|
1483
|
+
* once, never "org then global"). Native SDKs use platform attestation.
|
|
1436
1484
|
*/
|
|
1437
1485
|
interface AttestationInput {
|
|
1438
|
-
sandbox?: boolean;
|
|
1439
1486
|
signature?: string;
|
|
1440
1487
|
channel?: "hosted_web";
|
|
1441
1488
|
turnstileToken?: string;
|
|
@@ -1453,10 +1500,8 @@ interface AttestationInput {
|
|
|
1453
1500
|
interface LivenessInput {
|
|
1454
1501
|
clipKey: string;
|
|
1455
1502
|
attestation?: AttestationInput;
|
|
1456
|
-
/** Declared capture channel
|
|
1457
|
-
*
|
|
1458
|
-
* Client-declared by design (not a security boundary); absent = legacy
|
|
1459
|
-
* clients, treated as mobile server-side during the rollout window. */
|
|
1503
|
+
/** Declared capture channel, reported only (stored with the capture metadata): the server decides a desktop from
|
|
1504
|
+
* the request headers, never from this field. */
|
|
1460
1505
|
captureChannel?: 'mobile' | 'desktop';
|
|
1461
1506
|
/** Capture metadata (engine, dimensions, clip length, face-capture timing)
|
|
1462
1507
|
* — the backend's allowlisted, non-PII `capture` block (session insights). */
|
|
@@ -1477,10 +1522,21 @@ interface LivenessCaptureInput {
|
|
|
1477
1522
|
engine?: 'v1' | 'v3';
|
|
1478
1523
|
width?: number;
|
|
1479
1524
|
height?: number;
|
|
1525
|
+
/** The clip's duration (ms), read from its container when the SDK could. */
|
|
1480
1526
|
clipMs?: number;
|
|
1527
|
+
/** Video frames in the clip. */
|
|
1528
|
+
clipFrames?: number;
|
|
1529
|
+
/** The clip's frame rate (frames over its duration). */
|
|
1530
|
+
fps?: number;
|
|
1531
|
+
/** Silent re-recordings of the clip (0 or 1). */
|
|
1532
|
+
clipRetakes?: number;
|
|
1533
|
+
/** The clip's codec, from the recorder's type. */
|
|
1534
|
+
codec?: string;
|
|
1481
1535
|
cameraReadyMs?: number;
|
|
1482
1536
|
faceAcquireMs?: number;
|
|
1483
1537
|
captureMs?: number;
|
|
1538
|
+
/** Uploads settled → attestation token in hand (the Turnstile challenge on the web), ms. */
|
|
1539
|
+
attestationMs?: number;
|
|
1484
1540
|
/** The camera the clip was filmed with (`environment` = back). */
|
|
1485
1541
|
facingMode?: 'user' | 'environment';
|
|
1486
1542
|
/**
|
|
@@ -1520,6 +1576,23 @@ interface FaceMatchInput {
|
|
|
1520
1576
|
}
|
|
1521
1577
|
/** Document side (docs.types.ts DocSide). */
|
|
1522
1578
|
type DocSide = "recto" | "verso" | "single";
|
|
1579
|
+
/** The hosted view's `testerGate` block (spec 2026-11-09 §3.3). */
|
|
1580
|
+
interface HostedTesterGateView {
|
|
1581
|
+
offered: true;
|
|
1582
|
+
/** Gates left on this session (3 at most). */
|
|
1583
|
+
attemptsLeft: number;
|
|
1584
|
+
}
|
|
1585
|
+
/** Body `input` of `POST /hosted/tester-gate`: the liveness clip of the gate, in the liveness step's input shape. */
|
|
1586
|
+
interface TesterGateInput {
|
|
1587
|
+
clipKey: string;
|
|
1588
|
+
attestation?: AttestationInput;
|
|
1589
|
+
captureChannel?: "mobile" | "desktop";
|
|
1590
|
+
capture?: LivenessCaptureInput;
|
|
1591
|
+
}
|
|
1592
|
+
/** Answer of `POST /hosted/tester-gate`: the hosted view after the gate, and whether an enrolled tester was recognised. */
|
|
1593
|
+
type TesterGateResponse = HostedSessionView & {
|
|
1594
|
+
bound: boolean;
|
|
1595
|
+
};
|
|
1523
1596
|
/** The hosted view's `simulation` block (Sandbox DX spec 2026-11-06 §8): what a simulated session tells the flow. */
|
|
1524
1597
|
interface HostedSimulationView {
|
|
1525
1598
|
/** The code that passes the phone, email and national eID code screens: render it, nothing is delivered. */
|
|
@@ -1672,9 +1745,13 @@ interface PortraitIcaoInput {
|
|
|
1672
1745
|
* (presigned as a declared upload, no capture proof). Absent = `camera`.
|
|
1673
1746
|
*/
|
|
1674
1747
|
source?: PhotoSourcePick;
|
|
1675
|
-
/**
|
|
1748
|
+
/**
|
|
1749
|
+
* Camera only: the capture mode the portrait camera ran in (the step's, or the person's pick under `choice`) and the
|
|
1750
|
+
* camera the photo was taken with. An `assisted` photo on the front camera is refused with `capture_front_camera`.
|
|
1751
|
+
*/
|
|
1676
1752
|
capture?: {
|
|
1677
1753
|
mode: ResolvedCaptureMode;
|
|
1754
|
+
facingMode?: 'user' | 'environment';
|
|
1678
1755
|
};
|
|
1679
1756
|
}
|
|
1680
1757
|
/**
|
|
@@ -1729,4 +1806,4 @@ interface SubmitCheckBody {
|
|
|
1729
1806
|
forceOutcome?: "pass" | "fail" | "age_over" | "age_uncertain" | "age_under" | "age_unavailable";
|
|
1730
1807
|
}
|
|
1731
1808
|
|
|
1732
|
-
export { type
|
|
1809
|
+
export { type IdentityMethod as $, type AcceptedDocumentType as A, type HostedEidView as B, type CaptureContext as C, type DecisionReason as D, type EidAfterPass as E, type FaceMatchInput as F, type HostedEmailOtpView as G, type HostedAcceptedDocuments as H, type HostedFlowRef as I, type HostedIcaoPolicy as J, type HostedIntegrity as K, type HostedLivePhotoTuning as L, type HostedNativeCaptureTuning as M, type HostedOcrTuning as N, type HostedOtpView as O, type HostedPlanView as P, type HostedPortraitPendingFix as Q, type HostedPortraitView as R, type HostedSessionView as S, type HostedSimulationView as T, type HostedStepView as U, type HostedTesterGateView as V, type HostedVoiceLocale as W, type HostedVoiceView as X, type IcaoCriterion as Y, type IcaoReportEntry as Z, type IdentityConfirmDecision as _, type AttestationInput as a, ICAO_FALLBACK as a$, type IdentitySummarySource as a0, type IdentitySummaryView as a1, type LivenessCaptureInput as a2, type LivenessInput as a3, type LivenessReason as a4, type MatchReason as a5, type MediaKind as a6, type MethodChoiceView as a7, type NationalEidOption as a8, type NfcChipReason as a9, type SessionFailureReason as aA, type SessionReason as aB, type SessionStatus as aC, type SessionStepView as aD, type SessionView as aE, type SimulatedCaptureInput as aF, type StepResult as aG, type StepSection as aH, type SubmitCheckBody as aI, type TesterGateInput as aJ, type TesterGateResponse as aK, type VerificationAssurance as aL, type VerificationLevel as aM, type ScreenRampColour as aN, type AgeEstimationReason as aO, type CameraUnavailableCause as aP, type CaptureIssueReport as aQ, type CaptureProvenance as aR, type HostedBranding as aS, type HostedBrandingColorKey as aT, type HostedLivenessCaptureTuning as aU, type IcaoCaptureTuning as aV, type RetakeHint as aW, type ScreenRampChallenge as aX, type ScreenRampPaint as aY, type ScreenRampRendered as aZ, type ScreenRampReport as a_, type NfcStepView as aa, type OtpChoiceView as ab, type PhoneCountryRule as ac, type PhoneFormat as ad, type PhoneOtpInput as ae, type PhoneOtpReason as af, type PhotoSource as ag, type PhotoSourcePick as ah, type PlanAttempts as ai, type PlanChoiceKind as aj, type PlanChoiceOption as ak, type PlanChoiceView as al, type PlanSectionView as am, type PlanStepView as an, type PopulationInput as ao, type PopulationReason as ap, type PortraitFix as aq, type PortraitFixReviewInput as ar, type PortraitIcaoInput as as, type PortraitIcaoReason as at, type PortraitOutputFormat as au, type PresignRequest as av, type PresignUploadResult as aw, type RecordConsentResult as ax, type ResolvedCaptureMode as ay, type SessionDecidingStep as az, type CaptureMode as b, type IcaoProfile as b0, type ResolvedIcaoTuning as b1, resolveIcaoTuning as b2, type PersonMask as b3, type BackgroundUniformity as b4, type CaptureNoncesResult as c, type CaptureProof as d, type CheckInputByType as e, type CheckReason as f, type CheckState as g, type CheckType as h, type ClosedBy as i, type CompleteMediaResult as j, type ConsentLocale as k, type ContactChannel as l, type DocDeviceRead as m, type DocOcrInput as n, type DocReason as o, type DocSide as p, type EidAuthInput as q, type EidReason as r, type EmailOtpInput as s, type EmailOtpReason as t, type FaceMatchReason as u, type HostedCaptureTuning as v, type HostedConsentView as w, type HostedDocumentCaptureTuning as x, type HostedDocumentScanTuning as y, type HostedDocumentsView as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sekyro/web",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.23",
|
|
4
4
|
"description": "Sekyro AI web SDK \u2014 browser liveness capture, hosted-verification client and popup embed for Sekyro AI identity verification",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
package/sbom.cdx.json
CHANGED
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
"type": "application",
|
|
98
98
|
"name": "web",
|
|
99
99
|
"group": "@sekyro",
|
|
100
|
-
"version": "0.1.0-rc.
|
|
101
|
-
"bom-ref": "@sekyro/web@0.1.0-rc.
|
|
100
|
+
"version": "0.1.0-rc.23",
|
|
101
|
+
"bom-ref": "@sekyro/web@0.1.0-rc.23",
|
|
102
102
|
"description": "Sekyro AI web SDK — browser liveness capture, hosted-verification client and popup embed for Sekyro AI identity verification",
|
|
103
103
|
"licenses": [
|
|
104
104
|
{
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
],
|
|
111
|
-
"purl": "pkg:npm/%40sekyro/web@0.1.0-rc.
|
|
111
|
+
"purl": "pkg:npm/%40sekyro/web@0.1.0-rc.23?vcs_url=git%2Bhttps%3A%2F%2Fgithub.com%2FIBTIKAR-Technologies%2Fibtikar-identity.git%23packages%2Fsekyro-web",
|
|
112
112
|
"externalReferences": [
|
|
113
113
|
{
|
|
114
114
|
"url": "https://github.com/IBTIKAR-Technologies/ibtikar-identity/issues",
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"name": "tasks-vision",
|
|
151
151
|
"group": "@mediapipe",
|
|
152
152
|
"version": "0.10.35",
|
|
153
|
-
"bom-ref": "@sekyro/web@0.1.0-rc.
|
|
153
|
+
"bom-ref": "@sekyro/web@0.1.0-rc.23|@mediapipe/tasks-vision@0.10.35",
|
|
154
154
|
"licenses": [
|
|
155
155
|
{
|
|
156
156
|
"license": {
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"name": "thumbmarkjs",
|
|
186
186
|
"group": "@thumbmarkjs",
|
|
187
187
|
"version": "1.12.0",
|
|
188
|
-
"bom-ref": "@sekyro/web@0.1.0-rc.
|
|
188
|
+
"bom-ref": "@sekyro/web@0.1.0-rc.23|@thumbmarkjs/thumbmarkjs@1.12.0",
|
|
189
189
|
"licenses": [
|
|
190
190
|
{
|
|
191
191
|
"license": {
|
|
@@ -218,17 +218,17 @@
|
|
|
218
218
|
],
|
|
219
219
|
"dependencies": [
|
|
220
220
|
{
|
|
221
|
-
"ref": "@sekyro/web@0.1.0-rc.
|
|
221
|
+
"ref": "@sekyro/web@0.1.0-rc.23",
|
|
222
222
|
"dependsOn": [
|
|
223
|
-
"@sekyro/web@0.1.0-rc.
|
|
224
|
-
"@sekyro/web@0.1.0-rc.
|
|
223
|
+
"@sekyro/web@0.1.0-rc.23|@mediapipe/tasks-vision@0.10.35",
|
|
224
|
+
"@sekyro/web@0.1.0-rc.23|@thumbmarkjs/thumbmarkjs@1.12.0"
|
|
225
225
|
]
|
|
226
226
|
},
|
|
227
227
|
{
|
|
228
|
-
"ref": "@sekyro/web@0.1.0-rc.
|
|
228
|
+
"ref": "@sekyro/web@0.1.0-rc.23|@mediapipe/tasks-vision@0.10.35"
|
|
229
229
|
},
|
|
230
230
|
{
|
|
231
|
-
"ref": "@sekyro/web@0.1.0-rc.
|
|
231
|
+
"ref": "@sekyro/web@0.1.0-rc.23|@thumbmarkjs/thumbmarkjs@1.12.0"
|
|
232
232
|
}
|
|
233
233
|
]
|
|
234
234
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-TQB3URP2.js";export{a as bounded,c as cameraHash,b as hex16,d as noteCameraTrait};
|
package/dist/chunk-234OZEDB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as be,C as w,D as K,h as F,i as z,j as fe,k as he,m as Se,n as X,p as W,q as ee,s as ge,t as ye}from"./chunk-H3HVCWLF.js";import{c as le,d as pe,e as me}from"./chunk-FPXL63KZ.js";import{c as U,h as Q,i as Ce}from"./chunk-B2X33ZW2.js";var ke=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"];var Ze=["carte_identite","passport","residence_permit"];function Ye(e,t){let i=e.byIssuer?.[t]??e.default;return Ze.filter(o=>i==="*"||i.includes(o))}function Ft(e,t=ke){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(o=>Ye(e,o).length>0).sort()}function _e(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}var We=640,Qe=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),Pe=6,Re=1500,Me={sharpness:1,exposure:1,meanLuma:128},Ee=null;function qe(e,t){try{Ee??(Ee=document.createElement("canvas"));let i=Ee,o=96/Math.max(1,t.width);i.width=Math.max(1,Math.round(t.width*o)),i.height=Math.max(1,Math.round(t.height*o));let r=i.getContext("2d");if(r===null)return Me;r.drawImage(e,t.x,t.y,t.width,t.height,0,0,i.width,i.height);let c=r.getImageData(0,0,i.width,i.height);return{sharpness:pe(c),exposure:me(c),meanLuma:le(c)}}catch{return Me}}async function $e(e,t){let i=e.source;return"convertToBlob"in i?i.convertToBlob({type:"image/jpeg",quality:t}):new Promise((o,r)=>{i.toBlob(c=>c===null?r(new Error("encode failed")):o(c),"image/jpeg",t)})}function Wt(e,t={}){let i=t.now??(()=>performance.now()),o=t.setTimer??((m,P)=>setTimeout(m,P)),r=t.clearTimer??(m=>clearTimeout(m)),c=t.encode??$e,l=t.quality??qe,u=e.tuningVersion??null,p=new Set,y=!1,g=e.video??null,k=null,b=t.grabFrame??null,C=null,O=1e3/Pe,E=null,A=null,T=!1,x=!1,V=Number.NEGATIVE_INFINITY,M=null,H=0,N=null,G=null,$=Promise.all([import("./icao-gate-T3BTOKFJ.js"),import("./icao-tuning-4ETMF53W.js"),import("./create-portrait-capture-AGFHECK7.js"),import("./landmarker-KB7LVXAU.js"),import("./background-monitor-A7FKJOAG.js")]).then(async([m,P,R,v,I])=>{let n=P.resolveIcaoTuning(e.tuning,e.tuningVersion??void 0);n.background.required&&(A=I.createBackgroundMonitor({tuning:n.backgroundCheck,assetBaseUrl:e.assetBaseUrl??"/models-v3",...t.createSegmenter!==void 0?{createSegmenter:t.createSegmenter}:{},now:i})),k=m.createIcaoGate(n,{policy:e.policy??"reject"}),b??(b=R.defaultGrabber()),C=R.observe,O=1e3/Math.min(Pe,n.cadenceHz);let s=(t.createLandmarker??v.createFaceLandmarker)(e.assetBaseUrl??"/models-v3"),a=await new Promise((d,f)=>{let h=setTimeout(()=>{f(new Error("landmarker init timeout")),s.then(S=>S.close(),()=>{})},v.LANDMARKER_INIT_TIMEOUT_MS);s.then(S=>{clearTimeout(h),d(S)},S=>{clearTimeout(h),f(S)})});y?a.close():E=a}).catch(()=>{T=!0}),D=m=>{for(let P of p)P({holding:x||T,update:m})},j=()=>{if(M=null,!(y||E===null||k===null||b===null||C===null||g===null)){if(i()-V>Re){D(null);return}try{let m=b(g,We);if(m!==null){let P=Math.max(i(),H+1);H=P;let R=E.detect(m.source,P),v=g.videoWidth||m.width,I=g.videoHeight||m.height,n=C(R,m,v,I);n.geometry!==null&&A!==null&&(n.backgroundCheck=A.measure(m,n.geometry.box,v,I));let s=k.push(n,i());x=s.ready,D(s)}}catch{}M=o(j,O)}},Z=()=>{let m=i()-V>Re;V=i(),m&&(k?.reset(),x=!1,N=null,G=null),M===null&&E!==null&&!y&&(M=o(j,0))},J=()=>{let m=b===null||g===null?null:b(g,null);if(m===null||k===null||Math.max(m.width,m.height)<e.still.minLongSidePx)return Promise.resolve(null);let P=k.summary();return c(m,e.still.jpegQuality).then(R=>({image:R,width:m.width,height:m.height,gate:P}),()=>null)},Y=null;return{engineOptions:{measureQuality:(m,P)=>{g=m,Z();let R=l(m,P);return x||T?R:{...R,sharpness:0}},telemetry:m=>{if(m.type!=="fired"||y)return;N=J();let P=Y;P!==null&&N.then(R=>R===null?void 0:P(R).catch(()=>{})),x=!1,M!==null&&r(M),M=null,V=Number.NEGATIVE_INFINITY}},decorate:m=>{let P=new WeakMap,R=new Map,v=a=>{let d=P.get(a);return d===void 0&&(d=(async()=>{let f=await ye(m,"image","image/jpeg",a.image.size,{engine:"portrait"});return await m.uploadToSpaces(f.uploadUrl,a.image,"image/jpeg"),(await m.completeMedia(f.key)).key})(),d.catch(()=>P.delete(a)),P.set(a,d)),d};Y=v;let I=async a=>{let d;try{d=await v(a)}catch(f){let h=f?.code;if(typeof h=="string"&&Qe.has(h))throw f;return null}return{media:{portrait:d},gate:Ce(a.gate),...u!==null?{tuningVersion:u}:{}}},n=m.submitCheck.bind(m),s=(async(a,d,f)=>{if(a!=="liveness")return n(a,d,f);let h=f?.idempotencyKey,S=h===void 0?void 0:R.get(h);if(S===void 0){let ue=N;S=ue===null?Promise.resolve(null):ue.then(de=>de===null?null:I(de)),h!==void 0&&(R.set(h,S),S.catch(()=>R.delete(h)))}let _=await S;if(_===null)return n("liveness",d,f);let je=await n("liveness",{...d,portraitIcao:_},f);return G=_,je});return new Proxy(m,{get(a,d){if(d==="submitCheck")return s;let f=Reflect.get(a,d);return typeof f=="function"?f.bind(a):f}})},onGate:m=>(p.add(m),()=>p.delete(m)),lastPortraitInput:()=>G,destroy:()=>{y=!0,N=null,G=null,M!==null&&r(M),M=null,p.clear(),$.then(()=>{E?.close(),E=null,A?.close(),A=null})}}}function Ae(e){return e.idNumberBound??e.nniBound}function ve(e){return e===void 0?void 0:e.idNumberFromDocument??e.nniFromDocument}function Ie(e){let t=e.idNumberMasked??e.nniMasked;return typeof t=="string"&&t!==""?t:void 0}var Te=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",sandbox_nni_not_seeded:"sandbox_id_number_not_seeded",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),Je=new Map(Object.entries(Te)),$t=new Map(Object.entries(Te).map(([e,t])=>[t,e]));function we(e){return Je.get(e)??e}var ze=new Set(["phone_otp","email_otp","national_eid","document","nfc","population_registry","supplied_identity","summary_confirm","liveness","portrait","face_match","aml_screening","face_dedup","age_estimation"]),Xe=new Set(["supplied_identity","aml_screening","face_dedup","age_estimation"]),ne=["document","population_registry","national_eid"],ie=["phone_otp","email_otp"],Ne={identity_method:ne,contact:ie},et=["population_registry","document"],Le="platform_unsupported",tt=new Set(["prefilled","user_entered","prefilled_or_entered"]),nt={phone_otp:"contact",email_otp:"contact",eid_auth:"identity",doc_ocr:"identity",nfc_chip:"identity",population_registry:"identity",liveness:"live_photo",portrait_icao:"live_photo",face_match:"live_photo"};function L(e){return e.section??nt[e.checkType]??null}function oe(e,t){let i=e.plan?.choice;if(i===void 0||i.locked)return;let o=i.options.find(r=>r.id!==i.selected&&r.available!==!1&&t.includes(r.service));return o===void 0?void 0:{nodeId:i.nodeId,option:o}}function re(e){let t=e.plan,i=t?.choice;if(t===void 0||i===void 0||i.locked||t.current===null||t.current===i.nodeId||X(e))return null;let o=Ne[i.kind]??[...ne,...ie],r=i.options.flatMap(u=>u.available===!1||!o.includes(u.service)?[]:[u.nationalEid!=null?{id:u.id,service:u.service,nationalEid:u.nationalEid}:{id:u.id,service:u.service}]),c=t.steps.find(u=>u.id===t.current)?.service,l=i.selected??r.find(u=>u.service===c)?.id??null;return r.some(u=>u.id!==l)?{nodeId:i.nodeId,kind:i.kind,current:l,options:r}:null}function Ve(e){return e==null?[]:e.options.filter(t=>t.id!==e.current)}function it(e){let t=e.simulation;if(typeof t!="object"||t===null)return;let{otpCode:i,skipCapture:o}=t;return typeof i=="string"&&i!==""&&typeof o=="boolean"?{otpCode:i,skipCapture:o}:void 0}function ot(e){let t=(e.plan?.sections??[]).map(c=>({id:c.id,state:c.state})),i={sessionId:ee(e.sessionId),orgName:e.orgName,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:t.map(c=>c.id),progress:t,purpose:e.purpose??"identity"};e.branding!==void 0&&(i.branding=e.branding),e.cameraUnavailableHandled===!0&&(i.cameraUnavailableHandled=!0);let o=it(e);o!==void 0&&(i.simulation=o);let r=re(e);return r!==null&&(i.switchable=r),i}function rt(e){let t={attemptsRemaining:fe(e),attemptsExhausted:e.attemptsExhausted===!0};return e.reason!==void 0&&(t.reason=e.reason),e.retakeHint!==void 0&&(t.retakeHint=e.retakeHint),t}var De={phone_otp:"phone",email_otp:"email"};function st(e,t){let i=oe(e,[t==="phone_otp"?"email_otp":"phone_otp"]);return i===void 0?void 0:De[i.option.service]}function at(e,t,i,o){let r=t.checkType==="email_otp",c=(r?t.emailOtp:t.otp)??{},l=r?t.emailOtp?.emailSource:t.otp?.numberSource,u=l!==void 0&&tt.has(l)?l:r?"prefilled_or_entered":"user_entered",p=typeof c.sentToMasked=="string"&&c.sentToMasked.length>0,y=c.prefilled===!0,g=st(e,r?"email_otp":"phone_otp"),k={key:t.checkType,context:i,section:L(t),phase:p?"verify":"send",canSwitch:g!==void 0,...o},b=r?{kind:"email_otp",...k,emailSource:u,needsEmail:u!=="prefilled"&&!y}:{kind:"phone_otp",...k,numberSource:u,needsPhone:u!=="prefilled"&&!y,channels:(t.otp?.channels??[]).filter(C=>C==="whatsapp"||C==="sms")};if(g!==void 0&&(b.switchChannel=g),y&&(b.prefilled=!0),p&&(b.sentToMasked=c.sentToMasked),!r&&t.otp?.channel!==void 0&&(b.channel=t.otp.channel),!r&&Array.isArray(t.phoneCountries)&&(b.phoneCountries=t.phoneCountries.filter(C=>typeof C=="string"&&/^[A-Z]{2}$/.test(C))),!r&&Array.isArray(t.phoneRules)){let C=b.phoneCountries??[];b.phoneRules=t.phoneRules.flatMap(O=>{let E=dt(O);return E!==void 0&&C.includes(E.code)?[E]:[]})}return!r&&t.phoneInternational===!0&&(b.phoneInternational=!0),c.expiresAt!==void 0&&(b.codeExpiresAt=c.expiresAt),c.resendAvailableAt!==void 0&&(b.resendAvailableAt=c.resendAvailableAt),b}var ct=/^[\d[\]\-|()?:^]{1,64}$/;function ut(e){try{return typeof e=="string"&&ct.test(e)&&new RegExp(e)!==null}catch{return!1}}var Oe=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=15;function dt(e){let{code:t,dial:i,trunk:o,lengths:r,formats:c}=e??{};if(typeof t!="string"||typeof i!="string"||!/^\d{1,3}$/.test(i)||o!==void 0&&(typeof o!="string"||!/^\d{1,3}$/.test(o))||!Array.isArray(r)||r.length===0||!r.every(Oe))return;let l={code:t,dial:i,lengths:[...r].sort((u,p)=>u-p)};if(o!==void 0&&(l.trunk=o),c!==void 0){if(!(Array.isArray(c)&&c.length<=8&&c.every(p=>ut(p?.leading)&&Array.isArray(p.groups)&&p.groups.every(Oe)&&r.includes(p.groups.reduce((y,g)=>y+g,0)))))return;l.formats=c.map(p=>({leading:p.leading,groups:[...p.groups]}))}return l}function lt(e,t,i,o){let r=Ae(e)===!0?"bound":ve(t)===!0?"document":"typed",c=r==="typed"&&t.state==="input_required"&&t.reason!==void 0&&we(t.reason)==="id_number_recheck",l=Ve(re(e)),u=!o.attemptsExhausted&&l.length===1&&l[0]?.service==="document";return{kind:"registry",key:"registry",context:i,section:L(t),state:t.state==="input_required"?"input_required":"pending",source:r,recheck:c,canUseDocument:u,...o}}function pt(e,t,i,o){let r=[...t.acceptedSides??[]],c={kind:"document",key:"document",context:i,section:L(t),side:r.includes("recto")?"verso":"recto",acceptedSides:r,documents:_e(e),photo:He(e.documents),...o};return e.detectedCountry!==void 0&&(c.detectedCountry=e.detectedCountry),mt(e)&&(c.ageStepUp=!0),c}function He(e,t=!0){let i=e?.source==="upload"||e?.source==="choice"?e.source:"camera",o=e?.sourcePick==="camera"||e?.sourcePick==="upload"?e.sourcePick:null;return{source:i,pick:o,uploadOffered:t&&e?.uploadOffered===!0}}function mt(e){let t=z(e).find(o=>o.checkType==="age_estimation"),i=t?.reason;return t?.state==="failed"&&(i==="age_uncertain"||i==="age_unavailable")}function ft(e){let t=W(e,"liveness");return t?.state==="passed"||t?.state==="review"}function xe(e,t,i,o,r){let c=t.icao?.report,l=e.portrait,u=r==="capture"?l?.pendingFix??null:null;u!==null&&(r="review");let p=Ge(e);return{kind:"portrait",key:`portrait:${r}`,context:i,section:L(t),phase:r,report:Array.isArray(c)?c:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:Q(e),retakeOnly:r==="capture"&&t.state==="input_required"&&p===void 0&&e.capture?.livePhoto?.oneCapture===!0&&ft(e),photo:He(l,r==="capture"),pendingFix:u,...p!==void 0?{captureMode:p}:{},...l?.reuse?.pending===!0?{reuse:!0}:{},...o}}function Ge(e){let t=e.portrait?.captureMode;return t==="self"||t==="assisted"||t==="choice"?t:void 0}var te={minLongSidePx:1280,jpegQuality:.95};function ht(e,t){let i=e.capture?.livePhoto;if(i?.oneCapture!==!0)return null;let o=W(e,"portrait_icao"),r=i.still??te;return{icao:t==="liveness"&&Q(e)!==null&&Ge(e)===void 0&&o!==void 0&&o.state==="pending"&&o.reason===void 0,still:{minLongSidePx:r.minLongSidePx??te.minLongSidePx,jpegQuality:r.jpegQuality??te.jpegQuality}}}function St(e,t,i,o){let r=t.eid,c=L(t);if(r===void 0||r.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:i,section:c,checkType:"eid_auth",reason:"update_required"};let l=Ve(re(e)),u=l.length===1&&et.includes(l[0]?.service??"")?l[0]:void 0,p=u===void 0?void 0:F[u.service],y=p!==void 0,g={kind:"eid",key:"eid",context:i,section:c,provider:r.provider,providerName:r.providerName,country:r.country,challenge:"app_code",phase:r.awaiting==="code"?"code":"identifier",identifierBound:r.identifierBound===!0,canUseCamera:y,afterPass:r.afterPass==="continue"?"continue":"end",...o};return y&&(g.cameraMethod=p),r.expiresAt!==void 0&&(g.codeExpiresAt=r.expiresAt),r.resendAvailableAt!==void 0&&(g.resendAvailableAt=r.resendAvailableAt),r.resendsRemaining!==void 0&&(g.resendsRemaining=r.resendsRemaining),r.codeAttemptsRemaining!==void 0&&(g.codeAttemptsRemaining=r.codeAttemptsRemaining),g}function gt(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let i=W(e,"portrait_icao");return i!==void 0&&(i.state==="passed"||i.state==="review")?i:null}function yt(e){return z(e).filter(t=>t.state==="failed").pop()?.attemptsExhausted===!0}function bt(e,t){let i=e.failureReason,o;i===Le?o="platform_unsupported":e.status==="expired"?o="expired":e.status==="review_pending"?o="review":e.status==="completed"&&e.outcome==="approved"?o="approved":e.status==="completed"&&e.outcome==="review"?o="review":i==="device_cooldown"?o="cooldown":i!==void 0?o="policy_stop":yt(e)?o="attempts_exhausted":o="rejected";let r=o==="platform_unsupported"?{sessionId:ee(e.sessionId),status:"unavailable"}:ge(e,{autoRetry:!1}),c={kind:"result",key:"result",context:t,section:null,display:o,result:r};return i!==void 0&&(c.failureReason=i),e.retryAfter!==void 0&&(c.retryAfter=e.retryAfter),c}function Ct(e,t,i){let o=e.identitySummary;if(o==null)return null;let r={kind:"identity_summary",key:"identity_summary",context:t,section:i??"identity",summaryKind:o.kind==="partial"?"partial":o.kind??"full",source:o.source,portraitAvailable:o.portrait?.available===!0,retakeAvailable:o.retakeAvailable===!0};for(let l of kt){let u=o[l];typeof u=="string"&&u!==""&&(r[l]=u)}let c=Ie(o);return c!==void 0&&(r.idNumberMasked=c,r.nniMasked=c),r}var kt=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","expiryDate","retakeTarget"];function B(e,t,i,o){return{kind:"unsupported",key:`unsupported:${i}`,context:e,section:t,checkType:i,reason:o}}function _t(e){return e.kind==="contact"?"contact":(e.kind==="identity_method","identity")}function Pt(e,t){let i=Ne[e.kind]??[...ne,...ie],o=_t(e),r=e.options.flatMap(l=>{if(l.available===!1||!i.includes(l.service))return[];let u={id:l.id,service:l.service};l.nationalEid!=null&&(u.nationalEid=l.nationalEid);let p=(l.channels??[]).filter(y=>y==="whatsapp"||y==="sms");return l.service==="phone_otp"&&p.length>0&&(u.channels=p),[u]});if(r.length===0){let l=e.options.length>0&&e.options.every(u=>u.service==="nfc");return B(t,o,"choice",l?"platform_unsupported":"update_required")}let c={nodeId:e.nodeId,kind:e.kind,selected:e.selected,options:r};if(e.kind==="identity_method"){let l={kind:"method",key:"method",context:t,section:o,options:r.map(p=>F[p.service]),choice:c},u=r.find(p=>p.nationalEid!==void 0)?.nationalEid;return u!==void 0&&(l.nationalEid=u),l}return e.kind==="contact"?{kind:"contact_choice",key:"contact_choice",context:t,section:o,options:r.map(l=>De[l.service]),selected:null,locked:!1,choice:c}:{kind:"choice",key:`choice:${e.nodeId}`,context:t,section:o,choice:c}}function q(e,t={}){let i=ot(e);if(X(e)||e.failureReason===Le)return bt(e,i);let o=e.plan;if(o===void 0||!Array.isArray(o.sections))return B(i,null,"plan","update_required");let r=he(e);if(r!==null)return Pt(r,i);let c=o.current===null?void 0:o.steps.find(k=>k.id===o.current),l=k=>{let b={kind:"processing",key:"processing",context:i,section:k!==void 0?L(k):o.sections.find(C=>C.state==="current")?.id??null,stalled:!1};return typeof k?.service=="string"&&k.service!==""&&(b.service=k.service),b};if(o.current===null)return l(o.steps.find(k=>k.state==="processing"));if(c===void 0)return B(i,null,"step","update_required");if(!ze.has(c.service))return c.interaction==="server"?l(c):B(i,L(c),c.service,"update_required");if(Xe.has(c.service)||!Se(c))return l(c);let u=c,p=rt(u),y=u.checkType,g=L(u);switch(y){case"phone_otp":case"email_otp":return at(e,u,i,p);case"population_registry":return lt(e,u,i,p);case"eid_auth":return St(e,u,i,p);case"doc_ocr":return pt(e,u,i,p);case"identity_confirm":return Ct(e,i,g)??l(u);case"portrait_icao":return xe(e,u,i,p,"capture");case"liveness":case"face_match":{let k=gt(e,u);if(k!==null)return xe(e,k,i,p,"match");let b=u.requiresMobile===!0,C=Q(e);return b&&t.isMobile===!1?{kind:"mobile_required",key:"mobile_required",context:i,section:g,checkType:y}:{kind:"liveness",key:"biometric",context:i,section:g,mode:y==="face_match"?"selfie":"liveness",requiresMobile:b,instructions:C===null?"standard":"icao",icao:C,livePhoto:ht(e,y),...p}}case"nfc_chip":return B(i,g,y,"platform_unsupported");default:return B(i,g,y,"update_required")}}var Rt=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Mt=Object.freeze({normalize:e=>e.trim().toUpperCase().replace(/\s+/g," "),check:e=>Rt.test(e),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"});function Et(e){return typeof e=="string"&&/^\d{10}$/.test(e)&&Number(e)%97===1}var At=Object.freeze({normalize:e=>e.trim(),check:e=>Et(e),registrySources:Object.freeze(["MR.anrpts"]),describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}),vt=Object.freeze({"MR:national_id":At});function se(e,t){return vt[`${e.toUpperCase()}:${t}`]??Mt}var It=Object.freeze({MRT:"MR"});function Be(e,t){let i=e.trim().toUpperCase();return se(It[i]??i,t)}function Ue(e){let t=Be(e.issuingCountry,e.type);return t.check(t.normalize(e.number))}function Fe(e){return se("MR","national_id").check(e)}function ae(e){let t="";for(let i of e){let o=i.codePointAt(0)??0;o>=1632&&o<=1641?t+=String(o-1632):o>=1776&&o<=1785?t+=String(o-1776):i!==" "&&i!=="-"&&i!==" "&&(t+=i)}return t}var Tt=[1e3,2e3,4e3,8e3,15e3],wt=3e4,Ot=/^\+[1-9]\d{6,14}$/,xt=/^\d{6}$/,Nt=/^\d{6}$/,Lt=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ke=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","identity_confirm_locked","choice_locked","choice_option_unavailable","choice_not_found","step_not_on_path","check_not_active"]),Vt={simulatedCapture:!0},Dt=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]);function fn(e){let t=!1,i=null,o="",r=!1,c=!1,l=!1,u={},p={},y=new Set,g=!1,k=!1,b=null,C="idle",O=new Map,E=new Map,A=(n,s,a)=>{let d=`${n}.${s}`,f=O.get(d);if(f!==void 0)return f;let h=E.get(n),S=(h===void 0?a():h.then(a)).finally(()=>{O.delete(d)});O.set(d,S);let _=S.then(()=>{},()=>{});return E.set(n,_),_.then(()=>{E.get(n)===_&&E.delete(n)}),S},T=async(n,s,a)=>{await e.ensureConsent();let d;try{d=await be(e.runtime,s)}catch(h){if(h instanceof U&&Ke.has(h.code)){await e.refreshView();return}throw h}if(a?.(d),e.destroyed())return;let f=d;f.plan!==void 0&&e.setView!==void 0?e.setView(f):await e.refreshView()},x=async n=>{await e.ensureConsent();let s;try{try{s=await n(e.runtime.client)}catch(a){if(!(a instanceof U)||a.code!=="consent_required")throw a;await e.runtime.ensureConsent({force:!0}),s=await n(e.runtime.client)}}catch(a){if(a instanceof U&&Ke.has(a.code)){await e.refreshView();return}throw a}e.destroyed()||(s!==void 0&&e.setView!==void 0?e.setView(s):await e.refreshView())},V=(n,s)=>A("choice",`${n}:${s}`,()=>x(a=>a.choose(n,s))),M=(n,s)=>n.options.some(a=>a.id===s)?V(n.nodeId,s):Promise.reject(new RangeError(`option ${String(s)} is not offered`)),H=(n,s)=>{let a=e.currentView(),d=a===null?void 0:oe(a,n);return d===void 0?Promise.reject(new RangeError(`the ${s} is not offered`)):V(d.nodeId,d.option.id)},N=n=>A("identity",n,()=>x(s=>s.confirmIdentity===void 0?Promise.reject(new Error("identity confirmation is not available in this build")):s.confirmIdentity(n))),G=(n,s)=>{let a=n.kind,d=a==="phone_otp",f=d?"phone":"email",h={action:"send"};if(d?n.needsPhone:n.needsEmail){let S=s[f]??p[a],_=d?S?.replace(/[\s().-]/g,""):S?.trim();if(_!==void 0||n.phase!=="verify"){if(_===void 0||!(d?Ot:Lt).test(_))return Promise.reject(d?new w("phone","format"):new K("email","format"));h[f]=_}}if(d){let S=n.channels,_=s.channel??(S.length===1?S[0]:void 0);if(S.length>0){if(_===void 0)return Promise.reject(new K("channel","required"));if(!S.includes(_))return Promise.reject(new K("channel","unavailable"))}_!==void 0&&(h.channel=_),h.phoneRules=1}return A(a,"send",()=>T(a,(S,_)=>S.submitCheck(a,h,{idempotencyKey:_}),S=>{Gt(S,a)||(u[a]=e.now(),h[f]!==void 0&&(p[a]=h[f]))}))},$=(n,s)=>xt.test(s)?A(n,"verify",()=>T(n,(a,d)=>a.submitCheck(n,{action:"verify",code:s},{idempotencyKey:d}))):Promise.reject(new w("code","format")),D=(n,s)=>A("eid_auth",n,()=>T("eid_auth",(a,d)=>a.submitCheck("eid_auth",s,{idempotencyKey:d}))),j=(n,s)=>{if(n.identifierBound)return D("start",{action:"start"});let a=ae(s??"");if(n.country==="MR"){if(!/^\d{10}$/.test(a))return Promise.reject(new w("nni","format"));if(!Fe(a))return Promise.reject(new w("nni","check_digit"))}else if(a==="")return Promise.reject(new w("nni","format"));return D("start",{action:"start",identifier:a})},Z=(n,s,a)=>{if(n.source!=="typed")return Promise.reject(new RangeError("this session already holds the ID number"));let d=ae(s);return/^\d{10}$/.test(d)?Ue({type:"national_id",issuingCountry:"MR",number:d})?A("population_registry","submitIdNumber",()=>T("population_registry",(f,h)=>f.submitCheck("population_registry",{idNumber:d,nni:d},{idempotencyKey:h}),()=>{b=`\u2022\u2022\u2022\u2022\u2022\u2022${d.slice(-4)}`})):Promise.reject(new w(a,"check_digit")):Promise.reject(new w(a,"format"))},J=n=>(e.stopCameras?.(),A(n,"skipCapture",()=>T(n,(s,a)=>s.submitCheck(n,Vt,{idempotencyKey:a}),()=>{(n==="liveness"||n==="portrait_icao")&&(g=!0)}))),Y=n=>{if(n.kind==="result"||n.context.simulation?.skipCapture!==!0)return n;let s=Ht(n);return s===null?n:{...n,skipCapture:()=>J(s)}},ce=n=>{switch(n.kind){case"phone_otp":case"email_otp":{let s={...n,send:(d={})=>G(n,d),verify:d=>$(n.kind,d),switchTo:()=>n.canSwitch&&n.switchChannel!==void 0?H([n.switchChannel==="email"?"email_otp":"phone_otp"],"other contact option"):Promise.reject(new RangeError("this session has no other contact option"))},a=u[n.kind];return s.resendAvailableAt===void 0&&a!==void 0&&(s.resendAvailableAt=new Date(a+wt).toISOString()),s}case"eid":return{...n,start:s=>j(n,s),verify:s=>Nt.test(s)?D("verify",{action:"verify",code:s}):Promise.reject(new w("code","format")),resend:()=>n.resendsRemaining===0?Promise.reject(new RangeError("no new code can be sent for this session")):D("resend",{action:"resend"}),useCamera:()=>n.canUseCamera&&n.cameraMethod!==void 0?H(n.cameraMethod==="document_photo"?["document"]:["population_registry"],"camera path"):Promise.reject(new RangeError("the camera path is not offered"))};case"method":return{...n,select:s=>{let a=n.choice.options.find(d=>F[d.service]===s);return a!==void 0?M(n.choice,a.id):Promise.reject(new RangeError(`method ${String(s)} is not offered`))},choose:s=>M(n.choice,s)};case"choice":return{...n,choose:s=>M(n.choice,s)};case"registry":return{...n,submitIdNumber:s=>Z(n,s,"idNumber"),submitNni:s=>Z(n,s,"nni"),confirm:()=>A("population_registry","confirm",()=>T("population_registry",(s,a)=>s.submitCheck("population_registry",{},{idempotencyKey:a}))),useDocument:()=>n.canUseDocument?H(["document"],"document method"):Promise.reject(new RangeError("the document method is not offered"))};case"document":return e.bindDocument!==void 0?e.bindDocument(n,I):{...n,issuer:null,documentType:null,captureSide:null,selectDocument:()=>{throw new Error("document capture is not available in this build")},capture:()=>{throw new Error("document capture is not available in this build")},uploadDocument:()=>Promise.reject(new Error("document upload is not available in this build"))};case"portrait":return e.bindPortrait!==void 0?e.bindPortrait(n,I):{...n,uploadFailed:!1,resubmit:()=>Promise.resolve(),capture:()=>{throw new Error("portrait capture is not available in this build")},uploadPortrait:()=>Promise.reject(new Error("portrait upload is not available in this build")),confirmFix:()=>Promise.reject(new Error("portrait review is not available in this build"))};case"contact_choice":return{...n,select:s=>{let a=s==="phone"?"phone_otp":s==="email"?"email_otp":void 0,d=n.choice.options.find(f=>f.service===a);return d!==void 0?M(n.choice,d.id):Promise.reject(new RangeError(`contact ${String(s)} is not offered`))},choose:s=>M(n.choice,s)};case"identity_summary":return{...n,...n.idNumberMasked===void 0&&n.summaryKind==="partial"&&b!==null?{idNumberMasked:b,nniMasked:b}:{},portrait:async()=>{let s=e.runtime.client;if(!n.portraitAvailable||s.identityPortrait===void 0)return null;try{return await s.identityPortrait()}catch{return null}},confirm:()=>N("confirm"),retake:()=>n.retakeAvailable?N("retake"):Promise.reject(new RangeError("no retake is left"))};case"liveness":return{...n,capture:s=>e.liveness(s),onLivePhoto:s=>n.livePhoto?.icao===!0&&e.onLivePhoto!==void 0?e.onLivePhoto(s):()=>{}};case"mobile_required":case"processing":return{...n,refresh:async()=>{r=!1,await e.refreshView()}};case"unsupported":case"result":return{...n};default:{let s=n;throw new Error(`runner: unhandled step ${JSON.stringify(s)}`)}}},m=n=>Y(ce(n)),P=async()=>{if(!c){c=!0;try{for(let n of Tt){if(await e.sleep(n),!t||e.destroyed())return;let s=await e.refreshView().catch(()=>null);if(s!==null&&q(s,{isMobile:e.isMobile()}).kind!=="processing")return}r=!0,I()}finally{c=!1}}},R=n=>{if(n.kind!=="liveness"||n.mode!=="selfie")return null;let s={kind:"processing",key:"processing",context:n.context,section:n.section,stalled:!1};if(C==="inflight")return s;if(!k||C==="done")return null;let a=e.keptFaceKey?.()??null;return a===null?null:(C="inflight",T("face_match",(d,f)=>d.submitCheck("face_match",{imageKey:a},{idempotencyKey:f}),()=>{C="done"}).then(()=>{C==="inflight"&&(C="done",I())},()=>{C="done",I()}),s)},v=(n,s=!1)=>{if(!t||e.destroyed()||e.chainBusy())return;let a=q(n,{isMobile:e.isMobile()});a.kind==="registry"&&a.recheck&&(k=!0,C="idle"),a=R(a)??a,a.kind==="processing"?a.stalled=r:r=!1;let d=m(a),f=a.kind==="result"?void 0:a.context.switchable,h=f===void 0?d:{...d,chooseOption:_=>M({nodeId:f.nodeId,kind:f.kind,selected:f.current,options:f.options},_)},S=JSON.stringify(h);a.kind==="registry"&&a.source==="document"&&a.state==="pending"&&!y.has("registry")&&(y.add("registry"),h.confirm().catch(_=>{(!(_ instanceof U)||Dt.has(_.code))&&y.delete("registry")})),!(!s&&S===o)&&(o=S,i=h,e.emitStep(h),a.kind==="processing"&&!r&&C!=="inflight"&&P(),a.kind==="result"&&!l&&(l=!0,e.emitResult(a.result)))};function I(){let n=e.currentView();n!==null&&v(n,!0)}return{run:async()=>{if(e.destroyed())throw new Error("verification destroyed");t=!0;let n=await e.ensureView();return i===null&&v(n),i??m(q(n,{isMobile:e.isMobile()}))},current:()=>i,onView:n=>v(n),onChainIdle:()=>{let n=e.currentView();n!==null&&v(n)},republish:I,submit:T,faceProbeSkipped:()=>g}}function Ht(e){switch(e.kind){case"document":return"doc_ocr";case"liveness":return e.mode==="selfie"?"face_match":"liveness";case"portrait":return e.phase==="capture"?"portrait_icao":null;case"mobile_required":return e.checkType;case"unsupported":return e.checkType==="nfc_chip"?"nfc_chip":null;default:return null}}function Gt(e,t){let i=e,o=i?.plan?.steps??i?.steps;return Array.isArray(o)?o.some(r=>r.checkType===t&&typeof r.reason=="string"):!1}export{Ye as a,Ft as b,Pe as c,Re as d,Wt as e,Ge as f,q as g,Tt as h,wt as i,fn as j};
|