@sekyro/web 0.1.0-rc.2 → 0.1.0-rc.20

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 (133) hide show
  1. package/CHANGELOG.md +300 -0
  2. package/LICENSE +25 -16
  3. package/README.md +111 -60
  4. package/THIRD-PARTY-NOTICES.txt +154 -0
  5. package/dist/background-monitor-A7FKJOAG.js +1 -0
  6. package/dist/camera-trait-45MJTW4K.js +1 -0
  7. package/dist/capture-constraints-B5omafmk.d.cts +44 -0
  8. package/dist/capture-constraints-B5omafmk.d.ts +44 -0
  9. package/dist/capture-session-doc-QA4DOFRF.js +1 -0
  10. package/dist/{capture-session-v3-CAoWM8iT.d.cts → capture-session-v3-CNL-GX11.d.cts} +185 -15
  11. package/dist/{capture-session-v3-BJ8ciaWl.d.ts → capture-session-v3-DaBqN8fO.d.ts} +185 -15
  12. package/dist/chunk-5ZKQHFFW.js +1 -0
  13. package/dist/chunk-7ZCZY3ZP.js +1 -0
  14. package/dist/chunk-A3FUGHAH.js +2 -0
  15. package/dist/chunk-BPE5NSQ2.js +1 -0
  16. package/dist/chunk-CJHMFPL6.js +1 -0
  17. package/dist/chunk-CQ7SKLMC.js +1 -0
  18. package/dist/chunk-DFTCAWMP.js +1 -0
  19. package/dist/chunk-DK5YPBDQ.js +1 -0
  20. package/dist/chunk-FGOVIGGL.js +1 -0
  21. package/dist/chunk-FPXL63KZ.js +1 -0
  22. package/dist/chunk-FUHDOEBP.js +1 -0
  23. package/dist/chunk-G6LKLN4U.js +1 -0
  24. package/dist/chunk-GI3UFGRQ.js +1 -0
  25. package/dist/chunk-GT2ZLGF7.js +1 -0
  26. package/dist/chunk-IG466TOP.js +1 -0
  27. package/dist/chunk-KHR4U2SZ.js +1 -0
  28. package/dist/chunk-KZBBB5B2.js +1 -0
  29. package/dist/chunk-MXWLCDFX.js +1 -0
  30. package/dist/chunk-NJML6FMD.js +1 -0
  31. package/dist/chunk-O5WKNZ2C.js +1 -0
  32. package/dist/chunk-OKWG3PVH.js +1 -0
  33. package/dist/chunk-POIQGEZM.js +1 -0
  34. package/dist/chunk-RI3E7GBN.js +1 -0
  35. package/dist/chunk-SMKCBUJL.js +1 -0
  36. package/dist/chunk-TDLIXFDT.js +1 -0
  37. package/dist/chunk-TQB3URP2.js +1 -0
  38. package/dist/chunk-U6S7SCBY.js +1 -0
  39. package/dist/chunk-U6TYL2IJ.js +1 -0
  40. package/dist/chunk-W2WD7PR2.js +1 -0
  41. package/dist/chunk-XCKE2MJL.js +1 -0
  42. package/dist/chunk-ZLWH4RBO.js +1 -0
  43. package/dist/client/index.cjs +1 -357
  44. package/dist/client/index.d.cts +6 -37
  45. package/dist/client/index.d.ts +6 -37
  46. package/dist/client/index.js +1 -15
  47. package/dist/core/index.cjs +1 -1605
  48. package/dist/core/index.d.cts +5 -4
  49. package/dist/core/index.d.ts +5 -4
  50. package/dist/core/index.js +1 -139
  51. package/dist/core/ocr/worker.bundle.js +42 -0
  52. package/dist/core/ocr/worker.cjs +42 -0
  53. package/dist/core/ocr/worker.d.cts +84 -0
  54. package/dist/core/ocr/worker.d.ts +84 -0
  55. package/dist/core/ocr/worker.js +41 -0
  56. package/dist/core/v3/detect-worker.cjs +1 -392
  57. package/dist/core/v3/detect-worker.d.cts +1 -1
  58. package/dist/core/v3/detect-worker.d.ts +1 -1
  59. package/dist/core/v3/detect-worker.js +1 -13
  60. package/dist/create-document-capture-GJXBQMTC.js +1 -0
  61. package/dist/create-portrait-capture-MOS2D7CL.js +1 -0
  62. package/dist/create-verification-BBOUYpga.d.cts +3274 -0
  63. package/dist/create-verification-COpe2hxf.d.ts +3274 -0
  64. package/dist/{detect-worker-CKXHlXx9.d.cts → detect-worker-DclNxkZT.d.cts} +6 -0
  65. package/dist/{detect-worker-CKXHlXx9.d.ts → detect-worker-DclNxkZT.d.ts} +6 -0
  66. package/dist/detector-scanic-YCDNLCGV.js +1 -0
  67. package/dist/icao-gate-CEGvJR3q.d.ts +534 -0
  68. package/dist/icao-gate-PWBMKRGC.js +1 -0
  69. package/dist/icao-gate-l40OU6x1.d.cts +534 -0
  70. package/dist/icao-policy-BgI1Y870.d.ts +71 -0
  71. package/dist/icao-policy-C7fIdRzo.d.cts +71 -0
  72. package/dist/icao-tuning-4GGVX6B4.js +1 -0
  73. package/dist/index.cjs +1 -2636
  74. package/dist/index.d.cts +110 -5
  75. package/dist/index.d.ts +110 -5
  76. package/dist/index.js +1 -28
  77. package/dist/internal/index.cjs +1 -4166
  78. package/dist/internal/index.d.cts +365 -324
  79. package/dist/internal/index.d.ts +365 -324
  80. package/dist/internal/index.js +1 -647
  81. package/dist/keyframe-rank-YAJLYJYF.js +1 -0
  82. package/dist/landmarker-KB7LVXAU.js +1 -0
  83. package/dist/mrz-band-VYHOTDHY.js +1 -0
  84. package/dist/plan-runner-35655N4Z.js +1 -0
  85. package/dist/popup/index.cjs +1 -76
  86. package/dist/popup/index.d.cts +7 -1
  87. package/dist/popup/index.d.ts +7 -1
  88. package/dist/popup/index.js +1 -11
  89. package/dist/print-AYSCRSZB.js +1 -0
  90. package/dist/scanic-ml-stub-KW7IZHUT.js +1 -0
  91. package/dist/segmenter-USLNBX65.js +1 -0
  92. package/dist/turnstile-FATNZ4AG.js +1 -0
  93. package/dist/types-Dpfg2cO8.d.cts +1699 -0
  94. package/dist/types-Dpfg2cO8.d.ts +1699 -0
  95. package/dist/upload-file-UYXOHCRG.js +1 -0
  96. package/package.json +27 -11
  97. package/sbom.cdx.json +234 -0
  98. package/dist/capture-constraints-BujkZcfb.d.cts +0 -21
  99. package/dist/capture-constraints-BujkZcfb.d.ts +0 -21
  100. package/dist/chunk-BPYVZUJA.js +0 -852
  101. package/dist/chunk-BPYVZUJA.js.map +0 -1
  102. package/dist/chunk-LOTAJDRE.js +0 -1094
  103. package/dist/chunk-LOTAJDRE.js.map +0 -1
  104. package/dist/chunk-MWNFSNMP.js +0 -52
  105. package/dist/chunk-MWNFSNMP.js.map +0 -1
  106. package/dist/chunk-NILNKLK6.js +0 -50
  107. package/dist/chunk-NILNKLK6.js.map +0 -1
  108. package/dist/chunk-NWF46H7K.js +0 -359
  109. package/dist/chunk-NWF46H7K.js.map +0 -1
  110. package/dist/chunk-WY6U7AIK.js +0 -193
  111. package/dist/chunk-WY6U7AIK.js.map +0 -1
  112. package/dist/chunk-YVFF4Q4G.js +0 -327
  113. package/dist/chunk-YVFF4Q4G.js.map +0 -1
  114. package/dist/client/index.cjs.map +0 -1
  115. package/dist/client/index.js.map +0 -1
  116. package/dist/core/index.cjs.map +0 -1
  117. package/dist/core/index.js.map +0 -1
  118. package/dist/core/v3/detect-worker.cjs.map +0 -1
  119. package/dist/core/v3/detect-worker.js.map +0 -1
  120. package/dist/create-verification-CjLnJ0w6.d.ts +0 -348
  121. package/dist/create-verification-EnZ13uY4.d.cts +0 -348
  122. package/dist/detector-scanic-4C6IEW2K.js +0 -787
  123. package/dist/detector-scanic-4C6IEW2K.js.map +0 -1
  124. package/dist/hosted-client-BpvBqu9f.d.cts +0 -408
  125. package/dist/hosted-client-BpvBqu9f.d.ts +0 -408
  126. package/dist/index.cjs.map +0 -1
  127. package/dist/index.js.map +0 -1
  128. package/dist/internal/index.cjs.map +0 -1
  129. package/dist/internal/index.js.map +0 -1
  130. package/dist/popup/index.cjs.map +0 -1
  131. package/dist/popup/index.js.map +0 -1
  132. package/dist/scanic-ml-stub-S2OZ6HEF.js +0 -10
  133. package/dist/scanic-ml-stub-S2OZ6HEF.js.map +0 -1
@@ -0,0 +1,1699 @@
1
+ /** Server-tunable thresholds (`capture.icao.backgroundCheck`); defaults below. */
2
+ interface BackgroundCheckTuning {
3
+ /** Run the check at all (ICAO on). Default `true`. */
4
+ enabled: boolean;
5
+ /** Measurements per second (the face gate runs faster). Default 3. */
6
+ hz: number;
7
+ /** The segmenter must load within this window, else the strip fallback. Default 8000 ms. */
8
+ segmenterTimeoutMs: number;
9
+ /** A segmentation slower than this (moving average) switches to the strip fallback. Default 120 ms. */
10
+ segmenterBudgetMs: number;
11
+ /** Person confidence at or above this is the person (excluded). Default 0.5. */
12
+ maskThreshold: number;
13
+ /** Max RMS colour standard deviation (0..255). Default 28. */
14
+ maxColorStd: number;
15
+ /** Max share of textured neighbour pairs (0..1). Default 0.08. */
16
+ maxEdgeDensity: number;
17
+ /** Luma step (0..255) that counts as an edge. Default 24. */
18
+ edgeLuma: number;
19
+ /** Max left/right or top/bottom brightness difference (0..1). Default 0.18. */
20
+ maxGradient: number;
21
+ /** Fewer background pixels than this = not measurable (never blocks). Default 300. */
22
+ minPixels: number;
23
+ /** A non-uniform background holds the shot at most this long, then the shot proceeds. Default 4000 ms. */
24
+ timeoutMs: number;
25
+ }
26
+ /** Person confidence per pixel (0..1 floats, or 0..255 bytes), any resolution (scaled to the frame). */
27
+ interface PersonMask {
28
+ data: Float32Array | Uint8Array | Uint8ClampedArray;
29
+ width: number;
30
+ height: number;
31
+ }
32
+ /** One measurement — numbers only (telemetry and the `gate` block). */
33
+ interface BackgroundUniformity {
34
+ method: "segmenter" | "strip";
35
+ uniform: boolean;
36
+ colorStd: number;
37
+ edgeDensity: number;
38
+ gradient: number;
39
+ /** Background pixels measured (after sampling). */
40
+ pixels: number;
41
+ }
42
+
43
+ /** The device (coaching) limits of each profile — the server limits moved towards strict. */
44
+ declare const ICAO_DEVICE_LIMITS: {
45
+ readonly id_document: {
46
+ readonly pose: {
47
+ readonly yawDeg: 7;
48
+ readonly pitchDeg: 7;
49
+ readonly rollDeg: 5;
50
+ readonly pitchOffsetDeg: 4;
51
+ };
52
+ readonly eyes: {
53
+ readonly relativeMin: 0.62;
54
+ readonly blinkMax: 0.48;
55
+ };
56
+ readonly mouth: {
57
+ readonly jawOpenMax: 0.13;
58
+ readonly smileMax: 0.28;
59
+ readonly puckerMax: 0.28;
60
+ };
61
+ readonly lighting: {
62
+ readonly faceLuma: readonly [95, 185];
63
+ readonly halfRatio: readonly [0.77, 1.31];
64
+ readonly clippedMax: 0.015;
65
+ };
66
+ readonly background: {
67
+ readonly required: true;
68
+ readonly lumaMin: 165;
69
+ readonly lumaSdMax: 20;
70
+ };
71
+ readonly resolution: {
72
+ readonly minIodPx: 110;
73
+ readonly minWidth: 480;
74
+ readonly minHeight: 640;
75
+ };
76
+ };
77
+ readonly selfie: {
78
+ readonly pose: {
79
+ readonly yawDeg: 7;
80
+ readonly pitchDeg: 7;
81
+ readonly rollDeg: 7;
82
+ readonly pitchOffsetDeg: 4;
83
+ };
84
+ readonly eyes: {
85
+ readonly relativeMin: 0.62;
86
+ readonly blinkMax: 0.48;
87
+ };
88
+ readonly mouth: {
89
+ readonly jawOpenMax: 0.13;
90
+ readonly smileMax: 0.28;
91
+ readonly puckerMax: 0.28;
92
+ };
93
+ readonly lighting: {
94
+ readonly faceLuma: readonly [95, 185];
95
+ readonly halfRatio: readonly [0.77, 1.31];
96
+ readonly clippedMax: 0.015;
97
+ };
98
+ readonly background: {
99
+ readonly required: false;
100
+ readonly lumaMin: 165;
101
+ readonly lumaSdMax: 20;
102
+ };
103
+ readonly resolution: {
104
+ readonly minIodPx: 100;
105
+ readonly minWidth: 480;
106
+ readonly minHeight: 640;
107
+ };
108
+ };
109
+ };
110
+
111
+ /** The ICAO threshold set (`id_document`: ID photo; `selfie`: no background rule). */
112
+ type IcaoProfile = keyof typeof ICAO_DEVICE_LIMITS;
113
+ /** `capture.icao` as the server sends it (every field optional on the wire). */
114
+ interface IcaoCaptureTuning {
115
+ /** The threshold set these limits come from (default `id_document`; it also picks the fallbacks). */
116
+ profile?: "id_document" | "selfie";
117
+ yawDeg?: number;
118
+ pitchDeg?: number;
119
+ /**
120
+ * Subtracted from the measured pitch before `pitchDeg` applies (degrees). Where
121
+ * "looking straight" sits relative to the Landmarker's zero; kyc-portrait applies the
122
+ * same `PORTRAIT_POSE_PITCH_OFFSET_DEG`, so keep them equal (D9a, 2026-10-22).
123
+ */
124
+ pitchOffsetDeg?: number;
125
+ rollDeg?: number;
126
+ holdMs?: number;
127
+ /** `alert` policy: the clip starts this long after the face was accepted even if the ICAO gate is not ready (default 3000). */
128
+ alertGraceMs?: number;
129
+ eyes?: {
130
+ relativeMin?: number;
131
+ blinkMax?: number;
132
+ earMin?: number;
133
+ };
134
+ mouth?: {
135
+ jawOpenMax?: number;
136
+ smileMax?: number;
137
+ puckerMax?: number;
138
+ };
139
+ lighting?: {
140
+ faceLuma?: [number, number];
141
+ halfRatio?: [number, number];
142
+ clippedMax?: number;
143
+ };
144
+ /** `required: false` (the `selfie` profile): the background is not evaluated, coached or reported. */
145
+ background?: {
146
+ required?: boolean;
147
+ lumaMin?: number;
148
+ lumaSdMax?: number;
149
+ };
150
+ resolution?: {
151
+ minIodPx?: number;
152
+ minWidth?: number;
153
+ minHeight?: number;
154
+ };
155
+ /** Client-only knobs (no server field today; read when the server adds them). */
156
+ holdFrames?: number;
157
+ cadenceHz?: number;
158
+ baseline?: {
159
+ windowMs?: number;
160
+ minSamples?: number;
161
+ percentile?: number;
162
+ };
163
+ sharpnessMin?: number;
164
+ glare?: {
165
+ specularMax?: number;
166
+ };
167
+ softGraceMs?: number;
168
+ cropMargin?: number;
169
+ camera?: {
170
+ width?: number;
171
+ height?: number;
172
+ };
173
+ /**
174
+ * The client background-uniformity check (ID mode; defaults in
175
+ * core/portrait/background-uniformity.ts `BACKGROUND_CHECK_DEFAULTS`).
176
+ * Skipped entirely when `background.required` is false.
177
+ */
178
+ backgroundCheck?: Partial<BackgroundCheckTuning>;
179
+ }
180
+ /** Fully resolved limits the gate runs on. */
181
+ interface ResolvedIcaoTuning {
182
+ profile: IcaoProfile;
183
+ yawDeg: number;
184
+ pitchDeg: number;
185
+ pitchOffsetDeg: number;
186
+ rollDeg: number;
187
+ holdMs: number;
188
+ alertGraceMs: number;
189
+ eyes: {
190
+ relativeMin: number;
191
+ blinkMax: number;
192
+ };
193
+ mouth: {
194
+ jawOpenMax: number;
195
+ smileMax: number;
196
+ puckerMax: number;
197
+ };
198
+ lighting: {
199
+ faceLuma: [number, number];
200
+ halfRatio: [number, number];
201
+ clippedMax: number;
202
+ };
203
+ background: {
204
+ required: boolean;
205
+ lumaMin: number;
206
+ lumaSdMax: number;
207
+ };
208
+ resolution: {
209
+ minIodPx: number;
210
+ minWidth: number;
211
+ minHeight: number;
212
+ };
213
+ holdFrames: number;
214
+ cadenceHz: number;
215
+ baseline: {
216
+ windowMs: number;
217
+ minSamples: number;
218
+ percentile: number;
219
+ };
220
+ sharpnessMin: number;
221
+ glare: {
222
+ specularMax: number;
223
+ };
224
+ softGraceMs: number;
225
+ cropMargin: number;
226
+ camera: {
227
+ width: number;
228
+ height: number;
229
+ };
230
+ backgroundCheck: BackgroundCheckTuning;
231
+ /** The server's `capture.tuningVersion`, echoed on submit (`null` when absent). */
232
+ tuningVersion: string | null;
233
+ }
234
+ /** Bundled fallbacks: the `id_document` device limits (never looser than the server). */
235
+ declare const ICAO_FALLBACK: Omit<ResolvedIcaoTuning, "tuningVersion">;
236
+ /**
237
+ * Resolve `capture.icao` (any shape, possibly absent) over {@link ICAO_FALLBACK},
238
+ * field by field: an out-of-range or malformed field keeps its fallback.
239
+ */
240
+ declare function resolveIcaoTuning(raw: unknown, tuningVersion?: unknown): ResolvedIcaoTuning;
241
+
242
+ /** Session lifecycle status (spec §4 two-field status/outcome model). */
243
+ type SessionStatus = "created" | "in_progress" | "review_pending" | "completed" | "expired" | "failed";
244
+ /**
245
+ * Terminal verdict, orthogonal to `status`; `null` until terminal/review.
246
+ * `superseded` (status `completed`): the session waited for a review and a
247
+ * newer attempt of the same person took that review over; its review step
248
+ * failed with `superseded_by_retry`, and the verdict is on the newer session.
249
+ */
250
+ type SessionOutcome = "approved" | "review" | "rejected" | "superseded";
251
+ /**
252
+ * What a finished session proved (spec 2026-10-29 §3.2): `1` a live, real
253
+ * person, `2` that person's identity, `3` an identity corroborated by an
254
+ * independent source; `0` on a rejected session.
255
+ */
256
+ type VerificationLevel = 0 | 1 | 2 | 3;
257
+ /** How a session's {@link VerificationLevel} was proved (spec 2026-10-29 §3.4). */
258
+ type VerificationAssurance = "live_only" | "live_unique" | "document_biometric" | "chip_biometric" | "registry_biometric" | "supplied_biometric" | "eid_authenticated";
259
+ /** Per-check seven-state machine (spec §4.3). */
260
+ type CheckState = "pending" | "input_required" | "processing" | "passed" | "failed" | "review" | "skipped";
261
+ /**
262
+ * The frozen check-type vocabulary (CHECK_TYPES). `phone_otp` joined in Task 13;
263
+ * `nfc_chip` (M-nfc) is read by the native SDKs only; `email_otp` (Plan 8,
264
+ * profile v2 §4.6.5) confirms an email address with a one-time code;
265
+ * `eid_auth` (SDK spec §3.2) is the national eID sign-in (Houwiyeti in MR).
266
+ */
267
+ type CheckType = "liveness" | "face_match" | "doc_ocr" | "population_registry" | "phone_otp" | "nfc_chip" | "email_otp" | "portrait_icao" | "eid_auth";
268
+ type LivenessReason = "no_face" | "media_unreadable" | "clip_too_short" | "spoof_detected" | "review_band" | "liveness_inconclusive" | "device_integrity_failed" | "mobile_required" | "uncalibrated_capture_channel" | "capture_back_camera" | "capture_not_upright" | "camera_unavailable";
269
+ type PopulationReason = "registry_record_not_found" | "nni_not_found" | "id_number_invalid" | "nni_invalid" | "registry_unavailable" | "result_from_cache" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "id_number_recheck" | "nni_recheck";
270
+ 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" | "prior_review_rejected";
271
+ 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";
272
+ /**
273
+ * Profile v2 step 3 matching reasons: a field the partner sent at session
274
+ * create (`subject`) differs from the reference identity (document or
275
+ * registry). All four are final. `document_number_mismatch` is `doc_ocr` only.
276
+ */
277
+ type MatchReason = "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "document_number_mismatch";
278
+ /**
279
+ * Profile v2 step 4 decision-mode reasons (the app decides automatically
280
+ * instead of sending the case to human review). These park the step at
281
+ * `input_required` while attempts remain: `liveness_inconclusive` /
282
+ * `match_inconclusive` (middle score band) and `document_authenticity`
283
+ * (retake the original card). `mobile_required` is kept for compatibility:
284
+ * the backend now answers a non-phone capture with a request-level
285
+ * `409 mobile_required` (continue on a phone; nothing used, not billed).
286
+ */
287
+ type DecisionReason = "liveness_inconclusive" | "match_inconclusive" | "document_authenticity" | "mobile_required";
288
+ /**
289
+ * phone_otp reasons (Task 13). All transient — the caller fixes them by
290
+ * re-entering / resending: `otp_mismatch` (wrong or missing code),
291
+ * `otp_expired` (code lapsed or no active send), `otp_send_failed` (the OTP
292
+ * service was unreachable / a send returned no token).
293
+ */
294
+ type PhoneOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_channel_unavailable" | "otp_destination_not_allowed" | "otp_rate_limited" | "otp_resend_limit" | "otp_destination_unknown" | "otp_number_invalid" | "otp_number_not_mobile" | "otp_daily_cap_reached" | "payment_method_required" | "spend_cap_reached" | "insufficient_balance";
295
+ /**
296
+ * email_otp reasons (Plan 8, profile v2 §4.6.5). All transient: a wrong or
297
+ * expired code, a send outage, too many sends, an address that cannot receive
298
+ * mail (`email_invalid`), or a disposable address the app blocks
299
+ * (`email_disposable`) — the person enters another address or resends.
300
+ */
301
+ type EmailOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_rate_limited" | "otp_resend_limit" | "email_invalid" | "email_disposable" | "otp_daily_cap_reached";
302
+ /**
303
+ * nfc_chip reasons (M-nfc, SDK spec §4.3). Native SDKs read the chip; the web
304
+ * never does — on web the step arrives `skipped` (`platform_unsupported`) or
305
+ * the session shows `failureReason: 'platform_unsupported'`.
306
+ */
307
+ 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";
308
+ /**
309
+ * eid_auth reasons (SDK spec §3.2, generic national eID; Houwiyeti in MR).
310
+ * Retryable: `eid_identifier_invalid` (re-enter the number), `eid_code_invalid`
311
+ * (re-enter the code, see `eid.codeAttemptsRemaining`), `eid_code_expired`
312
+ * (ask for a new code), `eid_unavailable` (the provider is down; try again or
313
+ * use the camera), `eid_resend_too_soon` (wait for `eid.resendAvailableAt`),
314
+ * `eid_resend_limit` (no more codes; type the last code received).
315
+ * Final: `eid_locked` (too many wrong codes), `eid_not_enrolled` (the number
316
+ * has no account in the provider's app).
317
+ * With `eid_not_enrolled`, `eid_unavailable` or `eid_locked` the person may
318
+ * switch to the camera path when the session offers it.
319
+ */
320
+ type EidReason = "eid_identifier_invalid" | "eid_code_invalid" | "eid_code_expired" | "eid_locked" | "eid_not_enrolled" | "eid_unavailable" | "eid_resend_too_soon" | "eid_resend_limit";
321
+ /**
322
+ * Reasons of the age check (selfie) step (`age_estimation`, run by the server after the liveness step):
323
+ * `age_uncertain` (the estimate did not settle the minimum age) and `age_unavailable` (the estimate could not run)
324
+ * step up to the document path when the flow has one; `underage_estimated` (clearly under the flow's minimum age)
325
+ * is final and ends the session.
326
+ */
327
+ type AgeEstimationReason = "age_uncertain" | "age_unavailable" | "underage_estimated";
328
+ /**
329
+ * Any frozen reason code. The backend declares the field `string`, but the
330
+ * taxonomy is frozen (do-not-drift) — the union IS the contract. NB: liveness
331
+ * and face_match both carry `review_band`.
332
+ */
333
+ type CheckReason = LivenessReason | PopulationReason | FaceMatchReason | DocReason | PhoneOtpReason | EmailOtpReason | NfcChipReason | PortraitIcaoReason | EidReason
334
+ /**
335
+ * Spec 2026-10-27 (Sandbox testers), tester-bound sessions only:
336
+ * `tester_document_mismatch` (doc_ocr, nfc_chip) when the document read is
337
+ * not the bound tester's; `tester_phone_mismatch` (phone_otp) when the
338
+ * number is not the one the tester enrolled with.
339
+ */
340
+ | "tester_document_mismatch" | "tester_phone_mismatch"
341
+ /**
342
+ * Review outcomes, on any reviewed step: `superseded_by_retry` (a newer
343
+ * attempt of the same person took the review over; the session outcome is
344
+ * `superseded`) and `review_split` (two reviewers disagreed and nobody
345
+ * settled it before the review deadline; the session is rejected).
346
+ */
347
+ | "superseded_by_retry" | "review_split";
348
+ /**
349
+ * Session-level failure reasons: the session was stopped by a policy gate,
350
+ * not by a failed check. All are terminal (no retry on this session):
351
+ * - `location_not_allowed` / `anonymizer_blocked` (profile v2 step 2): the
352
+ * person's IP location is not allowed, or an anonymizer (VPN / proxy / Tor)
353
+ * was detected while the app blocks them;
354
+ * - `capture_tampered` (step 4): the device reported a tampered capture
355
+ * (virtual camera, hooking, emulator…) while the app blocks it;
356
+ * - `device_velocity_exceeded` (step 4): this device already verified too
357
+ * many different people while the app blocks it;
358
+ * - `device_cooldown` (step 4): this device had too many rejected sessions —
359
+ * {@link HostedSessionView.retryAfter} says when it may try again;
360
+ * - `platform_unsupported` (M-nfc): a chip read is required and this client
361
+ * can't read one (web); the session stays open for a native app;
362
+ * - `blocked_by_org`: one of the organization's blocks stopped the session.
363
+ */
364
+ type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown" | "platform_unsupported" | "blocked_by_org" | "starter_credit_claimed";
365
+ /**
366
+ * The profile-v2 policy reasons a session can end on: the two session-level
367
+ * reasons plus the failed check's policy reasons (`document_type_not_accepted`,
368
+ * `nationality_not_allowed`, `underage`, `age_unverifiable`,
369
+ * `document_id_number_mismatch`, formerly `document_nni_mismatch`).
370
+ */
371
+ type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "document_id_number_mismatch" | "document_nni_mismatch" | "camera_unavailable" | "underage_estimated";
372
+ /**
373
+ * Why the person has no camera (spec 2026-10-29 §3.4, 2026-10-30): `denied` when the camera permission was refused,
374
+ * `no_camera` when there is no usable camera (none found, an insecure page or a browser that cannot capture).
375
+ */
376
+ type CameraUnavailableCause = "denied" | "no_camera";
377
+ /**
378
+ * A capture failure the page showed (`POST /hosted/capture-issue`, 2026-11-04): a diagnostic record on the session that
379
+ * never changes it, never bills and never counts as an attempt. No personal data, no free text: `name` is a thrown
380
+ * error's `name` (letters only, at most 40 characters).
381
+ */
382
+ interface CaptureIssueReport {
383
+ /** The step whose camera failed (`portrait`: the portrait step's own camera, 2026-11-05). */
384
+ check: "liveness" | "document" | "portrait";
385
+ /** The public capture error kind shown, or `unavailable` (the SDK reason then rides in `engineKind`). */
386
+ kind: "permission" | "notfound" | "inuse" | "insecure" | "unsupported" | "generic" | "unavailable";
387
+ name?: string;
388
+ phase?: "preflight" | "acquiring" | "models" | "recording" | "keyframes" | "upload";
389
+ /** The engine kind before the public collapse, or the `unavailable` reason code (lower case, at most 32 characters). */
390
+ engineKind?: string;
391
+ /** Which capture attempt of the page failed (0 = the first). The client reports one issue per attempt and cause. */
392
+ attempt?: number;
393
+ formFactor?: "phone" | "tablet" | "desktop";
394
+ }
395
+ /**
396
+ * How the person proves their identity when the app makes the document
397
+ * optional for registry nationals (profile v2 step 3): type their national
398
+ * number (NNI) and skip the document, or photograph their document.
399
+ * `document_chip` is offered only to native clients with NFC (M-nfc).
400
+ * `national_eid` (SDK spec §3.2) signs in with the country's national eID
401
+ * (Houwiyeti in MR) instead of the camera path — see
402
+ * {@link MethodChoiceView.nationalEid}.
403
+ */
404
+ type IdentityMethod = "national_number" | "document_photo" | "document_chip" | "national_eid";
405
+ /**
406
+ * The national eID provider a session offers (`MethodChoiceView.nationalEid`).
407
+ * `provider` is `{ISO2}.{provider}` (e.g. `MR.houwiyeti`); `providerName` is
408
+ * the display name ("Houwiyeti").
409
+ */
410
+ interface NationalEidOption {
411
+ provider: string;
412
+ providerName: string;
413
+ /** ISO 3166-1 alpha-2 country of the provider. */
414
+ country: string;
415
+ /**
416
+ * What follows a passed eID (flow model 2026-10-23): `end` (the session ends,
417
+ * the default) or `continue` (the live photo follows). Absent on older APIs = `end`.
418
+ */
419
+ afterPass?: EidAfterPass;
420
+ }
421
+ /** What follows a passed national eID (`nationalEid.afterPass`). */
422
+ type EidAfterPass = "end" | "continue";
423
+ /**
424
+ * The section a step belongs to (flow model 2026-10-23, SDK spec §3.7): Step 1
425
+ * `contact`, Step 2 `identity`, Step 3 `live_photo`. Open: a value this SDK
426
+ * does not know is kept as is, so a client still places the step.
427
+ */
428
+ type StepSection = "contact" | "identity" | "live_photo" | "screening" | (string & {});
429
+ /** A contact channel of a contact choice (`phone_otp` → `phone`, `email_otp` → `email`). */
430
+ type ContactChannel = "phone" | "email";
431
+ /**
432
+ * @deprecated Sekyro flows: the contact choice is `plan.choice` (kind `contact`,
433
+ * {@link PlanChoiceView}); the view no longer carries this shape.
434
+ */
435
+ interface OtpChoiceView {
436
+ options: ContactChannel[];
437
+ selected: ContactChannel | null;
438
+ locked: boolean;
439
+ }
440
+ /** The flow version a session runs (`HostedSessionView.flow`). */
441
+ interface HostedFlowRef {
442
+ id: string;
443
+ slug: string;
444
+ version: number;
445
+ }
446
+ /** The kind of a choice node (Sekyro flows §7.4); a newer server's kind is kept as is. */
447
+ type PlanChoiceKind = "identity_method" | "contact" | "generic" | (string & {});
448
+ /** One option of a choice node, in the server's display order. */
449
+ interface PlanChoiceOption {
450
+ /** The option id sent back with {@link HostedClient.choose} (`document`, `registry`, `phone`, …). */
451
+ id: string;
452
+ /** The service of the option's lane (`document`, `nfc`, `population_registry`, `national_eid`, `phone_otp`, `email_otp`, …). */
453
+ service: string;
454
+ /** Unavailable options are omitted by the server; always `true` when listed. */
455
+ available: boolean;
456
+ /** `national_eid` options: the provider ("Verify with Houwiyeti"); absent or `null` otherwise and on older APIs. */
457
+ nationalEid?: NationalEidOption | null;
458
+ /**
459
+ * `phone_otp` options (flow UX refresh 2026-11-05): the step's channels in display order (informative: the contact
460
+ * choice stays Phone vs Email, the phone step offers the channels as equal buttons). Absent = SMS only or an older API.
461
+ */
462
+ channels?: ("whatsapp" | "sms")[];
463
+ }
464
+ /** `plan.choice`: the choice the person makes now (or may still switch, while `locked` is false). */
465
+ interface PlanChoiceView {
466
+ nodeId: string;
467
+ kind: PlanChoiceKind;
468
+ /** The chosen option id, `null` before a pick. */
469
+ selected: string | null;
470
+ /** The choice can no longer change (a submission into the chosen lane, or the option settled). */
471
+ locked: boolean;
472
+ options: PlanChoiceOption[];
473
+ }
474
+ /** Submissions used on a step and its cap (remaining = `max - used`). */
475
+ interface PlanAttempts {
476
+ used: number;
477
+ max: number;
478
+ }
479
+ /**
480
+ * A step of the plan (a visited node or the current one, never an untaken lane):
481
+ * its node id, service and state plus today's per-type extras (`otp`, `emailOtp`,
482
+ * `eid`, `nfc`, `docCapture`, `nniFromDocument`, `reason`, `icao`, `requiresMobile`, …).
483
+ * A node with two checks yields two steps (`n_live` liveness, `n_live.icao` the ICAO portrait).
484
+ */
485
+ interface PlanStepView extends Omit<HostedStepView, "checkType" | "attemptsRemaining" | "section"> {
486
+ /** The node id (`n_doc`), stable across views; `<node>.icao` for the ICAO portrait of a liveness node. */
487
+ id: string;
488
+ /** The catalog service of the node (`document`, `liveness`, `summary_confirm`, …). */
489
+ service: string;
490
+ /** The check this step submits (`doc_ocr`, `portrait_icao`, `identity_confirm`, …). */
491
+ checkType: CheckType | (string & {});
492
+ section: StepSection;
493
+ attempts: PlanAttempts;
494
+ /**
495
+ * Who acts on the step: `person` (a screen) or `server` (the backend runs it while the person waits). Sent by
496
+ * newer servers; a client renders an unknown `server` step as processing instead of asking for an update.
497
+ */
498
+ interaction?: "person" | "server";
499
+ }
500
+ /** A segment of the progress bar (`plan.sections`): the sections still possible on any remaining path. */
501
+ interface PlanSectionView {
502
+ id: StepSection;
503
+ state: "done" | "current" | "upcoming";
504
+ }
505
+ /** `HostedSessionView.plan` (Sekyro flows §8.1). */
506
+ interface HostedPlanView {
507
+ /** A choice node id (`plan.choice.nodeId`) or a step id; `null` while nothing waits on the person. */
508
+ current: string | null;
509
+ /** Present while `current` is a choice (and, on newer servers, while its lane can still be switched). */
510
+ choice?: PlanChoiceView;
511
+ steps: PlanStepView[];
512
+ sections: PlanSectionView[];
513
+ }
514
+ /** Where the identity summary's data came from. */
515
+ type IdentitySummarySource = "registry" | "document" | "chip";
516
+ /**
517
+ * Step 2b summary and confirm (`HostedSessionView.identitySummary`): the
518
+ * identity data read so far, shown to the person before the live photo. Only
519
+ * on the session-token view and only while the confirmation is pending; masks
520
+ * keep the last 4 characters. Never log or store these values.
521
+ */
522
+ interface IdentitySummaryView {
523
+ /**
524
+ * `full` (document / chip: the record and the photo) or `partial` (the
525
+ * registry from a typed number: the short name, the birth year, the number's
526
+ * last 4, no photo).
527
+ */
528
+ kind: "full" | "partial" | (string & {});
529
+ source: IdentitySummarySource | (string & {});
530
+ /** The full name (`full`), or the short form "Mohamed S." (`partial`). */
531
+ fullName?: string;
532
+ /** `YYYY-MM-DD` (`full`). */
533
+ birthDate?: string;
534
+ /** `YYYY` (`partial`). */
535
+ birthYear?: string;
536
+ /** ISO 3166-1 alpha-2 (or alpha-3) nationality. */
537
+ nationality?: string;
538
+ documentType?: string;
539
+ documentNumberMasked?: string;
540
+ /** The bound ID number, masked (last 4). @deprecated Read `idNumberMasked` (the server sends both). */
541
+ nniMasked?: string;
542
+ /** The bound ID number, masked (last 4). Absent from servers before person data Task A9: read `nniMasked` then. */
543
+ idNumberMasked?: string;
544
+ /** `YYYY-MM-DD`. */
545
+ expiryDate?: string;
546
+ /** A portrait can be fetched ({@link HostedClient.identityPortrait}). */
547
+ portrait: {
548
+ available: boolean;
549
+ };
550
+ /** A retake is still possible (attempts left, not a `supplied` summary). */
551
+ retakeAvailable: boolean;
552
+ /** What a retake re-opens. */
553
+ retakeTarget?: "document" | "national_number" | (string & {});
554
+ }
555
+ /** The answer to the identity summary ({@link HostedClient.confirmIdentity}). */
556
+ type IdentityConfirmDecision = "confirm" | "retake";
557
+ /**
558
+ * The pending identity-method choice in the 0.1 vocabulary, read from
559
+ * `plan.choice` (`kind: identity_method`): `document` → `document_photo`,
560
+ * `nfc` → `document_chip`, `population_registry` → `national_number`,
561
+ * `national_eid` → `national_eid`. See {@link Verification.methodChoice}.
562
+ */
563
+ interface MethodChoiceView {
564
+ /** The session offers the choice (the app's document mode is `optional`). */
565
+ available: boolean;
566
+ /** The chosen method, or `null` while the person has not chosen. */
567
+ selected: IdentityMethod | null;
568
+ /** The methods to offer, in display order (`national_eid` first when offered). */
569
+ options: IdentityMethod[];
570
+ /**
571
+ * The national eID provider behind the `national_eid` option ("Verify with
572
+ * Houwiyeti"). Absent when the option is not offered (and on older APIs).
573
+ */
574
+ nationalEid?: NationalEidOption;
575
+ }
576
+ /** A document type the backend reads (kyc-docs-v2 vocabulary; `carte_identite` = identity card of any issuer). */
577
+ type AcceptedDocumentType = "carte_identite" | "passport" | "residence_permit";
578
+ /**
579
+ * Accepted document types per issuing country (profile v2 §5.3a): an issuer
580
+ * uses `byIssuer[iso2] ?? default`; `"*"` = every type.
581
+ */
582
+ interface HostedAcceptedDocuments {
583
+ default: "*" | AcceptedDocumentType[];
584
+ byIssuer?: Record<string, AcceptedDocumentType[]>;
585
+ }
586
+ /**
587
+ * phone_otp DISPLAY-SAFE surface (Task 16). The backend stashes the OTP
588
+ * service `verifToken` on the check's persisted outputs (the doc_ocr partial
589
+ * mechanism), but that token is NEVER projected here — only the fields the
590
+ * hosted OTP step renders. `numberSource` (org-authored config) drives the
591
+ * send-phase UI (prefilled display vs entry); the rest appear ONLY once a send
592
+ * has parked the check (`sentToMasked` present ⇒ verify phase).
593
+ */
594
+ interface HostedOtpView {
595
+ /**
596
+ * Per-step `config.numberSource` — drives the send-phase UI (prefilled
597
+ * display vs entry). Narrowed to the frontend contract; the backend field is
598
+ * `string` (dynamic config) but the projection only ever emits these three.
599
+ */
600
+ numberSource?: "prefilled" | "user_entered" | "prefilled_or_entered";
601
+ /** Masked target the last send went to (e.g. `+222 ** ** 34 56`); absent pre-send. */
602
+ sentToMasked?: string;
603
+ /** Delivery channel of the last send. */
604
+ channel?: "sms" | "whatsapp";
605
+ /** ISO-8601 OTP expiry from the last send — drives the verify-phase countdown. */
606
+ expiresAt?: string;
607
+ /**
608
+ * Profile v2 §4.6.4: the channels the person may choose from, in display
609
+ * order (WhatsApp first; a channel the org or app turned off is absent).
610
+ * Absent on a session created before channel choice (no picker; SMS).
611
+ */
612
+ channels?: ("whatsapp" | "sms")[];
613
+ /**
614
+ * ISO-8601 end of the server-side resend cooldown (after a send; 30 s since the flow UX refresh 2026-11-05). It
615
+ * holds a resend to the same number only: a changed number is sent at once.
616
+ */
617
+ resendAvailableAt?: string;
618
+ /**
619
+ * Flow UX refresh 2026-11-05: the code goes to the number the partner supplied: show `otp.prefilledNotice` instead
620
+ * of the number field, and no "Change number". Absent otherwise.
621
+ */
622
+ prefilled?: true;
623
+ }
624
+ /**
625
+ * email_otp DISPLAY-SAFE surface (Plan 8, profile v2 §4.6.5): never the
626
+ * provider handle, never the address (only its mask).
627
+ */
628
+ interface HostedEmailOtpView {
629
+ /** Where the address comes from; drives the send-phase UI (notice vs entry). */
630
+ emailSource?: "prefilled" | "user_entered" | "prefilled_or_entered";
631
+ /** Masked target of the last send (e.g. `a•••@e•••.com`); absent pre-send. */
632
+ sentToMasked?: string;
633
+ /** ISO-8601 code expiry from the last send. */
634
+ expiresAt?: string;
635
+ /** ISO-8601 end of the server-side resend cooldown (after a send; holds a resend to the same address only). */
636
+ resendAvailableAt?: string;
637
+ /** Flow UX refresh 2026-11-05: the code goes to the address the partner supplied (`emailOtp.prefilledNotice`). */
638
+ prefilled?: true;
639
+ }
640
+ /**
641
+ * portrait_icao reasons (SDK spec §4.9, ID mode). The first failing ICAO
642
+ * criterion; every one is retryable (re-run only the ICAO gate).
643
+ * `media_unreadable` (no report) is shared with liveness.
644
+ */
645
+ type PortraitIcaoReason = "icao_pose" | "icao_eyes" | "icao_mouth" | "icao_occlusion" | "icao_lighting" | "icao_background" | "icao_resolution" | "portrait_not_from_liveness" | "portrait_recaptured" | "portrait_morph_suspected" | "portrait_reference_mismatch" | "portrait_declined_fix" | "portrait_fix_review";
646
+ /** One ICAO criterion of the server's portrait report (SDK spec §4.9). */
647
+ type IcaoCriterion = "pose" | "eyes" | "mouth" | "occlusion" | "glare" | "lighting" | "background" | "resolution";
648
+ /** The ICAO policy of a session's selfie (spec 2026-10-24 selfie ICAO policy §10). */
649
+ interface HostedIcaoPolicy {
650
+ /** `reject`: the gate blocks and the server asks for retakes; `alert`: coaching only, never blocking. */
651
+ policy: "reject" | "alert";
652
+ /** The threshold set: `id_document` (ID photo, uniform background) or `selfie` (no background rule). */
653
+ profile: "id_document" | "selfie";
654
+ }
655
+ /** `HostedSessionView.portrait`. */
656
+ type HostedPortraitView = NonNullable<HostedSessionView["portrait"]>;
657
+ /**
658
+ * Where the photo of the ID document step or the portrait step may come from (2026-11-05): `camera` (the camera
659
+ * screen; an upload only once the server offers it, after the camera could not open), `upload` (the upload screen at
660
+ * once) or `choice` (the person picks "Take a photo" or "Upload a photo", unless they already did for this step).
661
+ */
662
+ type PhotoSource = "camera" | "upload" | "choice";
663
+ /** Where a submitted photo came from (2026-11-05): the camera, or a photo picked from the device. Also the person's pick under `choice`. */
664
+ type PhotoSourcePick = "camera" | "upload";
665
+ /**
666
+ * The delivered photo's format (design 2026-11-04 §6.2): `icao_9303` (the 480×640 token image), `photo_35x45_300dpi`
667
+ * or `square_600`.
668
+ */
669
+ type PortraitOutputFormat = "icao_9303" | "photo_35x45_300dpi" | "square_600";
670
+ /**
671
+ * A fix the server applied to a portrait (design 2026-11-04 §6.4 step 2): geometry (`crop`, `scale`, `straighten`)
672
+ * for every output, plus `background`, `exposure` and `white_balance` for the photo formats other than `icao_9303`.
673
+ * The face itself is never changed. A newer server may name others: show the names it sends.
674
+ */
675
+ type PortraitFix = "crop" | "scale" | "straighten" | "background" | "exposure" | "white_balance";
676
+ /**
677
+ * `HostedSessionView.portrait.pendingFix` (design 2026-11-04 §6.4 step 4): the server adjusted the photo and waits for
678
+ * the person to accept it (`fixReview: confirm`). Both URLs are short-lived presigned GETs (until `expiresAt`); `fixes`
679
+ * lists what was changed, in the server's words ({@link PortraitFix}).
680
+ */
681
+ interface HostedPortraitPendingFix {
682
+ originalUrl: string;
683
+ fixedUrl: string;
684
+ fixes: string[];
685
+ expiresAt: string;
686
+ }
687
+ /** One row of the portrait_icao report: the server's measurement — coaching only. */
688
+ interface IcaoReportEntry {
689
+ criterion: IcaoCriterion;
690
+ value: number | null;
691
+ threshold: number | string | null;
692
+ pass: boolean;
693
+ }
694
+ /**
695
+ * eid_auth DISPLAY-SAFE surface (SDK spec §3.2): never the identifier, never
696
+ * the code. `awaiting` drives the screen: `identifier` (type the national
697
+ * number, unless `identifierBound`) → `code` (type the code shown in the
698
+ * provider's app).
699
+ */
700
+ interface HostedEidView {
701
+ /** `{ISO2}.{provider}`, e.g. `MR.houwiyeti`. */
702
+ provider: string;
703
+ /** Display name, e.g. "Houwiyeti". */
704
+ providerName: string;
705
+ /** ISO 3166-1 alpha-2 country of the provider. */
706
+ country: string;
707
+ /** `app_code`: the provider's app shows a code the person types here (the only challenge today). */
708
+ challenge: "app_code";
709
+ awaiting: "identifier" | "code";
710
+ /** The session is bound to the national number — `start` sends no identifier. */
711
+ identifierBound: boolean;
712
+ /** ISO-8601 expiry of the current code. */
713
+ expiresAt?: string;
714
+ /** ISO-8601 time from which a new code may be asked for. */
715
+ resendAvailableAt?: string;
716
+ /** New codes the person may still ask for in this session. */
717
+ resendsRemaining?: number;
718
+ /** Wrong codes left before `eid_locked`. */
719
+ codeAttemptsRemaining?: number;
720
+ /** What follows a pass (flow model 2026-10-23); absent = `end`. */
721
+ afterPass?: EidAfterPass;
722
+ }
723
+ /** `nfc_chip` step hints (M-nfc). `chipHint` is UI copy only, never a gate. */
724
+ interface NfcStepView {
725
+ mode: "preferred" | "mandatory";
726
+ access: ("PACE" | "BAC")[];
727
+ optionalDataGroups: ("DG11" | "DG12" | "DG13")[];
728
+ chipHint: {
729
+ default: Record<string, true | "unknown">;
730
+ byIssuer: Record<string, Record<string, true | "unknown">>;
731
+ };
732
+ /**
733
+ * Sekyro flows §7.7: where the chip key's MRZ comes from — `capture` (an
734
+ * MRZ-only scan before the chip read) or `document` (the earlier document step).
735
+ */
736
+ mrz?: {
737
+ source: "capture" | "document" | (string & {});
738
+ };
739
+ }
740
+ /**
741
+ * Liveness v7 §5.2: the retake hint's closed set (service `pipeline/retake_hint.py`, backend
742
+ * provenance picklist, copy keys `hints.*`): `appearance` (pad, deepfake, temporal signals),
743
+ * `motion` (no parallax or a high motion residual), `lighting` (low face luminance),
744
+ * `framing` (a small or clipped face box).
745
+ */
746
+ type RetakeHint = "appearance" | "motion" | "lighting" | "framing";
747
+ /**
748
+ * Per-check projection in a {@link HostedSessionView} — the spec'd hosted step
749
+ * shape. NEVER carries `calibratedScore` or the raw check `outputs`; the only
750
+ * output-derived data is the phone_otp `HostedOtpView` display subset
751
+ * (masked number/channel/expiry — never the verifToken).
752
+ */
753
+ interface HostedStepView {
754
+ checkType: CheckType;
755
+ state: CheckState;
756
+ /** Frozen-taxonomy reason code explaining a `failed`/`review` state. */
757
+ reason?: CheckReason;
758
+ /**
759
+ * Liveness v7 §5.2: what to change for the next capture, on a liveness step parked at
760
+ * `input_required` (the signal that weighed most in the inconclusive score). Absent on older
761
+ * APIs, on decisive results and on the other checks: then the reason's generic copy applies.
762
+ */
763
+ retakeHint?: RetakeHint;
764
+ /**
765
+ * Spec 2026-10-27: a Sandbox check answered by simulation (no provider or
766
+ * model ran). Absent on Live, on real Sandbox checks and on older APIs.
767
+ */
768
+ simulated?: boolean;
769
+ /**
770
+ * Submissions the page may still make for this check (`max(0, cap - attempts)`).
771
+ * Meaningful only while the check is executable — a finalized check may still
772
+ * report more than 0, but re-submitting it 409s regardless.
773
+ */
774
+ attemptsRemaining: number;
775
+ /** doc_ocr only: sides already accepted into the partial accumulator (['recto'] or ['verso']). */
776
+ acceptedSides?: ("recto" | "verso")[];
777
+ /** phone_otp only: the display-safe OTP send/config surface (never the verifToken). */
778
+ otp?: HostedOtpView;
779
+ /** email_otp only: the display-safe email send surface (never the handle or the address). */
780
+ emailOtp?: HostedEmailOtpView;
781
+ /**
782
+ * The check failed after using all of its attempts — no retry is left.
783
+ * Absent on older APIs (treat absent as `false`).
784
+ */
785
+ attemptsExhausted?: boolean;
786
+ /**
787
+ * population_registry only: the session is not bound to an NNI, but the
788
+ * document step already read a valid one — the page submits the registry
789
+ * check with an EMPTY input (no NNI field) and the backend uses the
790
+ * document's number. Absent on older APIs.
791
+ * @deprecated Read `idNumberFromDocument` (the server sends both).
792
+ */
793
+ nniFromDocument?: boolean;
794
+ /**
795
+ * population_registry only: the twin of `nniFromDocument` (person data spec §5.6),
796
+ * both present or both absent. Absent from servers before person data Task A9.
797
+ */
798
+ idNumberFromDocument?: boolean;
799
+ /**
800
+ * phone_otp only (person data spec Q16, Task A9): the countries the number may be
801
+ * from, ISO alpha-2, the first the default of the country picker. Absent from an
802
+ * older server: the person types a full international number.
803
+ */
804
+ phoneCountries?: string[];
805
+ /**
806
+ * phone_otp only (phone rules spec 2026-11-02 §2.1): one rule per `phoneCountries` entry, same order. Absent
807
+ * from an older server: the field then blocks nothing and groups nothing.
808
+ */
809
+ phoneRules?: PhoneCountryRule[];
810
+ /** phone_otp only (phone rules spec §2.1): numbers from other countries are accepted, through a free international field. */
811
+ phoneInternational?: true;
812
+ /**
813
+ * liveness / face_match (profile v2 step 4, decision mode `automatic`): the
814
+ * capture must come from a phone — the liveness band is calibrated on
815
+ * mobile captures only. A desktop page hands the person off to their phone
816
+ * instead of capturing (a desktop submission answers `mobile_required`).
817
+ * Absent on older APIs and in `review` mode.
818
+ */
819
+ requiresMobile?: boolean;
820
+ /** nfc_chip only (M-nfc). */
821
+ nfc?: NfcStepView;
822
+ /** portrait_icao only (SDK spec §4.9): the last attempt's per-criterion report. */
823
+ icao?: {
824
+ report: IcaoReportEntry[];
825
+ };
826
+ /** eid_auth only (SDK spec §3.2): the display-safe eID surface. */
827
+ eid?: HostedEidView;
828
+ /**
829
+ * The section of the flow this step belongs to (flow model 2026-10-23).
830
+ * Absent on older APIs (derive it from the check type).
831
+ */
832
+ section?: StepSection;
833
+ /**
834
+ * doc_ocr only, on an open step: the client reads the chip next, so the MRZ is
835
+ * read on device for the chip key (`mrz_for_chip`). Native NFC clients only.
836
+ */
837
+ docCapture?: {
838
+ mode: "mrz_for_chip" | (string & {});
839
+ };
840
+ }
841
+ /** A locale the Sekyro AI-hosted voice clips are recorded in. */
842
+ type HostedVoiceLocale = "ar" | "fr" | "en";
843
+ /**
844
+ * The session's Sekyro AI-hosted voice-guidance clips (the active clip set).
845
+ *
846
+ * `clips[locale]` maps a voice key (`fcv3.*`, the `@sekyro/react` voice-key
847
+ * namespace) to an ABSOLUTE URL on the Sekyro AI assets host
848
+ * (`https://assets.sekyro.ai/voice/<setId>/<locale>/<name>.mp3`; staging:
849
+ * `assets-staging.sekyro.ai`). URLs are immutable per `setId`. A locale or key
850
+ * may be missing — the player falls back to the device voice for it.
851
+ *
852
+ * A page with a Content-Security-Policy must allow the assets origin in
853
+ * `media-src` for the clips to play (see the partner web-SDK guide, CSP note).
854
+ */
855
+ interface HostedVoiceView {
856
+ /** Identifier of the active clip set (part of every clip URL). */
857
+ setId: string;
858
+ /** Per-locale map of voice key (`fcv3.*`) → absolute clip URL. */
859
+ clips: {
860
+ readonly [L in HostedVoiceLocale]?: Readonly<Record<string, string>>;
861
+ };
862
+ }
863
+ /**
864
+ * A branding colour key (each value is `#rrggbb`).
865
+ *
866
+ * Status colours (`danger`, `success`, `warning`) are no longer part of partner
867
+ * branding: they are standard on every partner page since 0.1.0-rc.15 and
868
+ * follow the partner surface automatically.
869
+ */
870
+ type HostedBrandingColorKey = "brand" | "brandFg" | "bg" | "surface" | "fg" | "fgMuted";
871
+ /**
872
+ * The org / app branding of a session (`HostedSessionView.branding`): only the
873
+ * fields set in the dashboard, merged per field (app over org). A field the
874
+ * org and app left unset is ABSENT — keep your default for it; the whole
875
+ * object is absent when nothing is set. `logoUrl` is a short-lived signed URL
876
+ * (15 minutes).
877
+ */
878
+ interface HostedBranding {
879
+ /** Signed URL of the logo (PNG or sanitized SVG); absent when none is set. */
880
+ logoUrl?: string;
881
+ /** Colours as `#rrggbb`. */
882
+ colors?: Partial<Record<HostedBrandingColorKey, string>>;
883
+ /** Corner radius step. */
884
+ radius?: "none" | "sm" | "md" | "lg" | "full";
885
+ /** Font choice (system fallbacks when the font is not installed). */
886
+ fontFamily?: "system" | "inter" | "ibm-plex-sans-arabic" | "noto-sans-arabic" | "roboto";
887
+ /**
888
+ * Spec 2026-10-29 D16: the org hides the "Verified by Sekyro AI" attribution (hosted frame and SDK footer).
889
+ * Present (true) only then; absent on older APIs.
890
+ */
891
+ hideAttribution?: boolean;
892
+ }
893
+ /**
894
+ * Token-addressed hosted-page bootstrap (`GET /hosted/session`). A separate
895
+ * shape from the partner `SessionView`: `sessionId` instead of `id`,
896
+ * hosted step hints, the consent flag, and the org display name (may be `''`
897
+ * when the org lookup degrades).
898
+ */
899
+ /**
900
+ * Server-delivered capture tuning (`HostedSessionView.capture`, SDK spec §3.5).
901
+ * Coaching values only. `@sekyro/web` does not apply it yet (its built-in v3
902
+ * values stay in force until the adopting minor release); native SDKs apply it
903
+ * field by field over their bundled fallbacks and ignore unknown fields.
904
+ */
905
+ interface HostedCaptureTuning {
906
+ tuningVersion?: string;
907
+ liveness?: HostedLivenessCaptureTuning;
908
+ document?: Record<string, unknown>;
909
+ /** SDK spec §5.4 ID mode: the strict ICAO gate's coaching limits (present with `portrait`). */
910
+ icao?: IcaoCaptureTuning;
911
+ /**
912
+ * Step 3 one-capture live photo (flow model 2026-10-23): one camera session
913
+ * records the clip AND a full-resolution still (long side at least
914
+ * `still.minLongSidePx`, JPEG `still.jpegQuality`).
915
+ */
916
+ livePhoto?: HostedLivePhotoTuning;
917
+ /**
918
+ * Who films the face, set in the flow (always present on current backends):
919
+ * - `self` — the person films themselves: front camera only, no camera
920
+ * choice, phone held upright;
921
+ * - `assisted` — an agent films the person: back camera by default, the
922
+ * front/back switch allowed, phone held upright.
923
+ * `@sekyro/web` enforces it on a capture bound to the session; an absent
924
+ * value falls back to {@link HostedCaptureTuning.cameraSwitch}, then `self`.
925
+ */
926
+ mode?: CaptureMode;
927
+ /**
928
+ * @deprecated Mirror of `mode === 'assisted'`, kept for older clients. Read
929
+ * {@link HostedCaptureTuning.mode}.
930
+ */
931
+ cameraSwitch?: boolean;
932
+ }
933
+ /**
934
+ * Who films the face (`HostedSessionView.capture.mode`, a flow setting):
935
+ * `self` (the person, front camera), `assisted` (an agent, back camera) or
936
+ * `choice` (the person picks `self` or `assisted` on the first camera step,
937
+ * once for the session: {@link ResolvedCaptureMode}).
938
+ */
939
+ type CaptureMode = "self" | "assisted" | "choice";
940
+ /** The mode a camera runs in: the session's {@link CaptureMode}, or the person's pick under `choice`. */
941
+ type ResolvedCaptureMode = "self" | "assisted";
942
+ /** `capture.livePhoto` (flow model 2026-10-23, Step 3). */
943
+ interface HostedLivePhotoTuning {
944
+ oneCapture: boolean;
945
+ still: {
946
+ minLongSidePx: number;
947
+ jpegQuality: number;
948
+ };
949
+ }
950
+ /**
951
+ * `capture.liveness`: the face gate's coaching values (open; web keeps its built-in v3 values) and, from liveness v7,
952
+ * the screen-ramp challenge the web SDK renders while the clip records.
953
+ */
954
+ interface HostedLivenessCaptureTuning {
955
+ [field: string]: unknown;
956
+ /**
957
+ * Liveness v7 §4.4: the server-issued screen-ramp challenge of this session. Absent (older backends, assisted
958
+ * sessions, the ramp switched off): no ramp is rendered and the submit carries no `screenRamp`.
959
+ */
960
+ screenRamp?: ScreenRampChallenge;
961
+ }
962
+ /**
963
+ * The closed palette of the screen ramp (liveness v7 §4.4). Each name maps to one fixed sRGB value in `@sekyro/web`
964
+ * (`screenRampColourValue`); the service verifies the clip against the same values.
965
+ */
966
+ type ScreenRampColour = 'rose' | 'peach' | 'sand' | 'mint' | 'sky' | 'lilac';
967
+ /**
968
+ * The screen-ramp challenge issued per session (liveness v7 §4.4, §4.5 item 1): three colours shown for 400 ms each,
969
+ * starting at `onsetsMs[i]` on the clip's own timeline (the backend jitters each onset inside its slot). The layer
970
+ * returns to transparent at 2,000 ms. The client renders exactly this and reports what it rendered
971
+ * ({@link ScreenRampReport}); the backend forwards the issued challenge to the model service.
972
+ */
973
+ interface ScreenRampChallenge {
974
+ /** Ties the report to the issued challenge (echoed in {@link ScreenRampReport.nonce}). */
975
+ nonce: string;
976
+ colours: [ScreenRampColour, ScreenRampColour, ScreenRampColour];
977
+ /** Whole ms on the clip timeline, ascending, each inside the 800 to 2,000 ms window. */
978
+ onsetsMs: [number, number, number];
979
+ /** The palette the colours were drawn from (informational; the client renders `colours`). */
980
+ palette: ScreenRampColour[];
981
+ }
982
+ /** One rendered colour change: `tMs` on the clip timeline (whole ms, ≥ 0). */
983
+ interface ScreenRampRendered {
984
+ tMs: number;
985
+ colour: ScreenRampColour;
986
+ }
987
+ /** `LivenessCaptureInput.screenRamp`: what the SDK rendered against the issued {@link ScreenRampChallenge}. */
988
+ interface ScreenRampReport {
989
+ nonce: string;
990
+ /** In render order, at most three entries. */
991
+ rendered: ScreenRampRendered[];
992
+ }
993
+ /**
994
+ * `LivenessCaptureInput.provenance` (liveness v7 §4.5 item 2): how the web capture was made. Signals only, no media,
995
+ * no raw device identifiers. The backend allowlists it into the capture metadata; the model service turns it into
996
+ * the `virtual_camera | capture_tampered | replay_suspected` signals with its own thresholds and label list.
997
+ */
998
+ interface CaptureProvenance {
999
+ /** The selected video track's `getSettings()`; `deviceIdHash` is the first 16 hex of SHA-256(deviceId). */
1000
+ trackSettings: {
1001
+ facingMode?: 'user' | 'environment' | 'left' | 'right';
1002
+ frameRate?: number;
1003
+ width?: number;
1004
+ height?: number;
1005
+ deviceIdHash?: string;
1006
+ };
1007
+ /** `MediaStreamTrack.getCapabilities` exists on this browser (absent on Firefox; virtual stacks often lack it). */
1008
+ capabilitiesPresent: boolean;
1009
+ /**
1010
+ * The track label against the SDK's small list of virtual-camera products (`known_virtual`), the platform's own
1011
+ * camera naming (`platform`), or anything else, an empty label included (`unknown`).
1012
+ */
1013
+ labelClass: 'known_virtual' | 'unknown' | 'platform';
1014
+ /**
1015
+ * `requestVideoFrameCallback` statistics over the recording: frames seen, mean and standard deviation of the
1016
+ * inter-frame gap (ms), and the mean `presentationTime - captureTime` (ms) when the browser reports `captureTime`
1017
+ * (null otherwise). All zero with `n: 0` when the browser has no `requestVideoFrameCallback`.
1018
+ */
1019
+ rvfc: {
1020
+ n: number;
1021
+ meanGapMs: number;
1022
+ stdGapMs: number;
1023
+ captureLatencyMs: number | null;
1024
+ };
1025
+ /** `getUserMedia` and `MediaStreamTrack.prototype.getSettings` are still native code (not replaced by a page script). */
1026
+ prototypesIntact: boolean;
1027
+ /**
1028
+ * The engine ran this capture with a screen-ramp painter: a self capture handed the session's challenge with a
1029
+ * `ramp` listener bound. `false` for a host that never binds `ramp`, an assisted capture, a keyframe-only capture
1030
+ * or a session without a challenge. The backend keys `ramp_missing` on this flag, not on the SDK version: a
1031
+ * `true` capture without `screenRamp` is missing, a `false` one is a client without the ramp.
1032
+ */
1033
+ rampPainter: boolean;
1034
+ }
1035
+ /**
1036
+ * {@link HostedCaptureTuning} with the native-only document fields typed. The wire shape is
1037
+ * the same; `HostedSessionView.capture` stays the open {@link HostedCaptureTuning} so existing
1038
+ * consumers keep compiling. Narrow it where the typed fields are read:
1039
+ * `const capture = view.capture as HostedNativeCaptureTuning | undefined`.
1040
+ */
1041
+ interface HostedNativeCaptureTuning extends HostedCaptureTuning {
1042
+ document?: HostedDocumentCaptureTuning;
1043
+ }
1044
+ /**
1045
+ * `capture.document`. Only the native-only fields the SDKs share a name for are typed;
1046
+ * the rest (gate, aspect, upload, …) stay open. Web ignores the whole block.
1047
+ */
1048
+ interface HostedDocumentCaptureTuning {
1049
+ [field: string]: unknown;
1050
+ /** Native document scan machine thresholds (web does not read them). */
1051
+ scan?: HostedDocumentScanTuning;
1052
+ /** Native on-device OCR tuning (web ignores it; SDK spec §5.2). */
1053
+ ocr?: HostedOcrTuning;
1054
+ }
1055
+ /** `capture.document.scan` — native scan thresholds; only the blur gate is typed here. */
1056
+ interface HostedDocumentScanTuning {
1057
+ [field: string]: unknown;
1058
+ /** Blur gate: a captured photo whose native sharpness is under this is refused and retaken. */
1059
+ blurRefuseSharpnessMax?: number;
1060
+ }
1061
+ /** `capture.document.ocr` — native on-device OCR tuning (web ignores it; SDK spec §5.2). */
1062
+ interface HostedOcrTuning {
1063
+ enabledOnline?: boolean;
1064
+ enabledOffline?: boolean;
1065
+ warmup?: boolean;
1066
+ maxDeviceLatencyMs?: number;
1067
+ deviceTimeoutMs?: number;
1068
+ minAvailMemoryMb?: number;
1069
+ minConfidenceForRetake?: number;
1070
+ minSegmentsForRetake?: number;
1071
+ submitGraceMs?: number;
1072
+ reportSampleRate?: number;
1073
+ readBudgetMs?: number;
1074
+ classifyBudgetMs?: number;
1075
+ deferArabicOnline?: boolean;
1076
+ detectorLimit?: number;
1077
+ detectorThreadsMax?: number;
1078
+ recognizerThreads?: number;
1079
+ recognitionWorkersMax?: number;
1080
+ linesInFlight?: number;
1081
+ widestLineFirst?: boolean;
1082
+ scriptRouting?: boolean;
1083
+ arabicColumnFirst?: boolean;
1084
+ confidentLatinScore?: number;
1085
+ minLatinLetters?: number;
1086
+ arabicColumnStart?: number;
1087
+ arabicOnlyScore?: number;
1088
+ portraitProbeLimit?: number;
1089
+ }
1090
+ /** Native device attestation parameters (`HostedSessionView.integrity`, SDK spec §6.7). Web ignores it. */
1091
+ interface HostedIntegrity {
1092
+ mode: "off" | "signal" | "enforce";
1093
+ android?: {
1094
+ cloudProjectNumber: number;
1095
+ };
1096
+ ios?: {
1097
+ appAttest: true;
1098
+ };
1099
+ }
1100
+ interface HostedSessionView {
1101
+ sessionId: string;
1102
+ status: SessionStatus;
1103
+ outcome: SessionOutcome | null;
1104
+ /** ISO-8601 timestamp (Date on the server, string on the wire). */
1105
+ expiresAt: string;
1106
+ consentRecorded: boolean;
1107
+ orgName: string;
1108
+ /**
1109
+ * The FIRST allowlisted web-SDK origin of the owning org (Task 12), or null
1110
+ * when none is registered. The hosted page posts the SDK popup postMessage
1111
+ * events (event name, sessionId and the level when known) to exactly this origin — never `'*'`.
1112
+ * The backend declares it required (`string | null`); optional here so
1113
+ * pre-Task-12 consumers/fixtures stay valid (additive field, always on the
1114
+ * wire from Task 12 onward).
1115
+ */
1116
+ sdkOrigin?: string | null;
1117
+ /**
1118
+ * Cloudflare Turnstile site key the browser must solve an execute-mode
1119
+ * challenge against before submitting `liveness` (Plan A Task 5): the org's
1120
+ * own widget key when the request origin is one of the org's allowlisted SDK
1121
+ * origins, else the hosted widget key, else `null`. `null` means the session
1122
+ * cannot be attested from the browser — the SDK sends `{sandbox: true}`,
1123
+ * which the backend honours ONLY on sandbox sessions (fails closed on live).
1124
+ */
1125
+ turnstileSiteKey: string | null;
1126
+ /**
1127
+ * A Sandbox (test) session: the hosted page marks it as a test session.
1128
+ * Optional: absent on an older backend.
1129
+ */
1130
+ sandbox?: boolean;
1131
+ /** Spec 2026-10-27: this session enrolls a Sandbox tester (the hosted page shows the removal link at the end). */
1132
+ testerEnrollment?: boolean;
1133
+ /**
1134
+ * The session was minted with a server-bound NNI (`POST /sessions`
1135
+ * `input.nni`, Plan A Task 2): `population_registry` is submitted with an
1136
+ * EMPTY input and the backend reads the sealed value. `false` means the
1137
+ * person must supply the NNI (hosted population form); the SDK never submits
1138
+ * the registry check on an unbound session. The VALUE is never exposed. The
1139
+ * backend declares it required; optional here so pre-Task-8 fixtures stay
1140
+ * valid (additive field, always on the wire from Task 8 onward).
1141
+ * Registry-scoped: an MR national ID number the registry can look up.
1142
+ */
1143
+ nniBound?: boolean;
1144
+ /**
1145
+ * Person data spec §5.6: the generic name of `nniBound`, with the same meaning:
1146
+ * the session holds an ID number the registry step can look up, so the step is
1147
+ * submitted with an empty input. A bound passport or another country's number is
1148
+ * not registry-bound. Absent from servers before person data Task A9.
1149
+ */
1150
+ idNumberBound?: boolean;
1151
+ /**
1152
+ * The Sekyro AI-hosted voice-guidance clips of this session, or `null` when no
1153
+ * clip set is active (the device voice is used). Optional: older APIs omit
1154
+ * the field — treat absent like `null`.
1155
+ */
1156
+ voice?: HostedVoiceView | null;
1157
+ /**
1158
+ * Why the session ended, when a profile-v2 policy stopped it: a
1159
+ * {@link SessionFailureReason}, or the failed check's reason when it is a
1160
+ * policy reason (eligibility, or `document_nni_mismatch`). Absent otherwise
1161
+ * (and on older APIs).
1162
+ */
1163
+ failureReason?: PolicyFailureReason;
1164
+ /**
1165
+ * The document types the person may pick, resolved for issuer `MR`,
1166
+ * `carte_identite`/`passport` only (older pickers). Absent on older APIs —
1167
+ * treat absent as both.
1168
+ */
1169
+ acceptedDocumentTypes?: AcceptedDocumentType[];
1170
+ /**
1171
+ * Accepted document types per issuing country — drives the issuer-first
1172
+ * picker. Absent on older APIs (fall back to `acceptedDocumentTypes` for MR).
1173
+ */
1174
+ acceptedDocuments?: HostedAcceptedDocuments;
1175
+ /**
1176
+ * ISO-8601 time from which this device may verify again — set with
1177
+ * `failureReason: 'device_cooldown'` (profile v2 step 4). Absent otherwise
1178
+ * (and on older APIs).
1179
+ */
1180
+ retryAfter?: string;
1181
+ /**
1182
+ * What the session proved, once it is terminal (spec 2026-10-29 §3.2);
1183
+ * `null` while it runs. Absent on older APIs.
1184
+ */
1185
+ level?: VerificationLevel | null;
1186
+ /** How the level was proved, once terminal; `null` while it runs. Absent on older APIs. */
1187
+ assurance?: VerificationAssurance | null;
1188
+ /**
1189
+ * A returning-user session (profile v2 step 5): the person verified before
1190
+ * and this session only confirms it is still them — liveness and a face
1191
+ * match against their stored photo. Hosts read it to say "Confirm it's
1192
+ * you". Absent on full sessions (and on older APIs).
1193
+ */
1194
+ returning?: true;
1195
+ /**
1196
+ * The org / app branding (settings spec §5.1). Absent on older APIs — keep
1197
+ * the default theme. Map it with `brandingToTheme()` from `@sekyro/react`.
1198
+ */
1199
+ branding?: HostedBranding;
1200
+ /** Capture coaching tuning (SDK spec §3.5). Absent on older APIs. */
1201
+ capture?: HostedCaptureTuning;
1202
+ /** Native device attestation parameters; absent for web-only apps and on older APIs. */
1203
+ integrity?: HostedIntegrity;
1204
+ /**
1205
+ * SDK spec §3.5: present when the session runs the ICAO portrait step — the
1206
+ * client runs the ICAO gate (read it with `icaoPolicyOf`). `icao` is absent on
1207
+ * older servers, which send `{ purpose: "id_document" }` alone (= `reject`, `id_document`).
1208
+ */
1209
+ portrait?: {
1210
+ purpose: "id_document";
1211
+ /** Present whenever a `portrait_icao` step runs (absent on older servers): `reject` / `id_document`. */
1212
+ icao?: HostedIcaoPolicy;
1213
+ /**
1214
+ * 2026-11-05: where the portrait step's photo may come from. Absent on older servers and on a portrait that
1215
+ * rides the liveness capture (= `camera`).
1216
+ */
1217
+ source?: PhotoSource;
1218
+ /** The person's pick under `choice`, once made for this step (do not ask again: a retry). */
1219
+ sourcePick?: PhotoSourcePick;
1220
+ /**
1221
+ * An upload would be accepted now (`upload`, or `choice` without a camera pick; never on a camera step).
1222
+ * Absent on older servers (= `false`).
1223
+ */
1224
+ uploadOffered?: boolean;
1225
+ /** The server adjusts a nearly compliant photo (crop, scale, straighten; more for the photo formats). */
1226
+ fixes?: boolean;
1227
+ /** `confirm`: the person accepts an adjusted photo before it is used ({@link HostedPortraitPendingFix}). */
1228
+ fixReview?: "confirm" | "silent";
1229
+ /** The delivered photo's format. */
1230
+ output?: PortraitOutputFormat;
1231
+ /** The adjusted photo waiting for the person's answer (`portrait_icao` with `{ fixReview: { accept } }`). */
1232
+ pendingFix?: HostedPortraitPendingFix;
1233
+ /**
1234
+ * Design 2026-11-04 §4, §6.3: the portrait step's own capture mode when it has its own screen (`self` /
1235
+ * `assisted`; under `choice` the person's pick once made, else `choice`: ask who takes the photo). Absent = the
1236
+ * still rides the liveness capture (one capture), whatever `capture.livePhoto.oneCapture` says.
1237
+ */
1238
+ captureMode?: CaptureMode;
1239
+ /**
1240
+ * Design 2026-11-04 §6.6: a returning person's earlier photo is waiting to be bound to today's liveness: submit
1241
+ * `portrait_icao` with `{}` (no photo). A dropped reuse clears it and the step asks for a photo.
1242
+ */
1243
+ reuse?: {
1244
+ pending: true;
1245
+ };
1246
+ } | {
1247
+ /** A verification selfie checked against the ICAO selfie rules (selfie ICAO policy). */
1248
+ purpose: "verification";
1249
+ icao: HostedIcaoPolicy;
1250
+ /** As on `id_document` (design 2026-11-04 §6.2): newer servers send the step's settings with either purpose. */
1251
+ source?: PhotoSource;
1252
+ sourcePick?: PhotoSourcePick;
1253
+ uploadOffered?: boolean;
1254
+ fixes?: boolean;
1255
+ fixReview?: "confirm" | "silent";
1256
+ output?: PortraitOutputFormat;
1257
+ pendingFix?: HostedPortraitPendingFix;
1258
+ captureMode?: CaptureMode;
1259
+ reuse?: {
1260
+ pending: true;
1261
+ };
1262
+ };
1263
+ /** The flow version the session runs (Sekyro flows §9.2). */
1264
+ flow?: HostedFlowRef;
1265
+ /**
1266
+ * What the person does now (Sekyro flows §8.1), the only source of the
1267
+ * steps: render `plan.current`. Absent on an active session only from a
1268
+ * backend older than the flows release (the SDK then asks for an update).
1269
+ */
1270
+ plan?: HostedPlanView;
1271
+ /** Step 2b identity summary, present only while its confirmation is pending. */
1272
+ identitySummary?: IdentitySummaryView;
1273
+ /**
1274
+ * Spec 2026-10-29 §6.7: the copy set the session's screens use: `human` (the person proves they are a real person:
1275
+ * one intro line, the short Human consent terms) or `identity`. Absent on older APIs: treat as `identity`.
1276
+ */
1277
+ purpose?: "human" | "identity";
1278
+ /**
1279
+ * Spec 2026-10-29 §3.4: `true` when a flow fallback takes over a missing camera at the live step
1280
+ * (`POST /hosted/camera-unavailable` continues the session instead of ending it). Absent otherwise and on
1281
+ * older APIs. Offer "continue without a camera" only then, or on a `human` session.
1282
+ */
1283
+ cameraUnavailableHandled?: true;
1284
+ /**
1285
+ * 2026-11-05: where the ID document step's photo may come from. Absent when the open document step is camera only
1286
+ * with no upload offered (and on older APIs): `{ source: "camera", uploadOffered: false }`.
1287
+ */
1288
+ documents?: HostedDocumentsView;
1289
+ /**
1290
+ * Spec 2026-10-29 D12: where the hosted completion screen sends the person (`returnUrl`, checked at session
1291
+ * create against the app's web origins or native scheme) and the partner's opaque `state`. Never the result.
1292
+ * Absent when the session has no return link (and on older APIs).
1293
+ */
1294
+ link?: {
1295
+ returnUrl?: string;
1296
+ state?: string;
1297
+ };
1298
+ /**
1299
+ * Custom domains (spec 2026-11-02 §5.4): `origin` = where this session's link was minted, `hosts` = the
1300
+ * hostnames allowed to serve it (the platform host, then the org's active custom hostnames). Absent on older
1301
+ * APIs; the SDK does not need it.
1302
+ */
1303
+ hosted?: {
1304
+ origin: string;
1305
+ hosts: string[];
1306
+ };
1307
+ }
1308
+ /** `POST /hosted/consent` result — 201 on first record, 200 `{alreadyRecorded: true}` on replay. */
1309
+ /**
1310
+ * `POST /hosted/consent` answer (Sekyro flows §8.2): the hosted view with
1311
+ * `consentRecorded: true`, plus whether consent was already on record.
1312
+ */
1313
+ type HostedConsentView = HostedSessionView & RecordConsentResult;
1314
+ interface RecordConsentResult {
1315
+ alreadyRecorded: boolean;
1316
+ }
1317
+ /**
1318
+ * Consent locale: the page's `[locale]` URL segment echoed back (HostedConsentSchema picklist). The six end-user
1319
+ * locales (spec 2026-10-29 §9); a backend older than Plan C accepts ar/fr/en only.
1320
+ */
1321
+ type ConsentLocale = "ar" | "fr" | "en" | "es" | "pt" | "de";
1322
+ /** Per-check projection in a {@link SessionView} — enum/id only, never civil data. */
1323
+ interface SessionStepView {
1324
+ checkType: CheckType;
1325
+ state: CheckState;
1326
+ reason?: CheckReason;
1327
+ /**
1328
+ * Spec 2026-10-27: a Sandbox check answered by simulation (no provider or
1329
+ * model ran). Absent on Live, on real Sandbox checks and on older APIs.
1330
+ */
1331
+ simulated?: boolean;
1332
+ calibratedScore?: number;
1333
+ /** The check failed after using all of its attempts. Absent on older APIs. */
1334
+ attemptsExhausted?: boolean;
1335
+ /** portrait_icao only (SDK spec §4.9): the last attempt's per-criterion report. */
1336
+ report?: IcaoReportEntry[];
1337
+ }
1338
+ /**
1339
+ * Client-facing session projection returned by
1340
+ * `POST /sessions/:id/checks/:checkType`. Whitelist-only — never the client token.
1341
+ */
1342
+ interface SessionView {
1343
+ id: string;
1344
+ status: SessionStatus;
1345
+ outcome: SessionOutcome | null;
1346
+ /** Profile-v2 policy stop reason; absent on ordinary failures and older APIs. */
1347
+ failureReason?: PolicyFailureReason;
1348
+ steps: SessionStepView[];
1349
+ /** ISO-8601 timestamp (Date on the server, string on the wire). */
1350
+ expiresAt: string;
1351
+ /** ISO-8601 timestamp (Date on the server, string on the wire). */
1352
+ createdAt?: string;
1353
+ }
1354
+ /** Media class — selects size cap, MIME allowlist and promoted prefix (media.policy.ts). */
1355
+ type MediaKind = "image" | "clip";
1356
+ /**
1357
+ * Body of `POST /sessions/:id/media`. `contentType`/`contentLength` are the
1358
+ * exact values SIGNED into the presigned PUT — the PUT must send them verbatim.
1359
+ * Allowlists (media.policy.ts): image → image/jpeg | image/png (5 MB cap);
1360
+ * clip → video/webm | video/mp4 (15 MB cap). BARE types only — no `;codecs=` params.
1361
+ */
1362
+ interface PresignRequest {
1363
+ kind: MediaKind;
1364
+ contentType: string;
1365
+ contentLength: number;
1366
+ /** D8: the live-camera capture proof (image / clip from the SDK capture flows only). */
1367
+ capture?: CaptureProof;
1368
+ /**
1369
+ * Design 2026-11-04 §5.2: `upload` = a photo of the document picked from the device (`image` only, no capture
1370
+ * proof). Accepted only while the session's document step accepts an upload (else 400 `document_upload_not_allowed`);
1371
+ * the promoted key can then only be submitted as `doc_ocr` with `source: "upload"` (else 400
1372
+ * `uploaded_media_not_allowed`).
1373
+ */
1374
+ source?: "upload";
1375
+ }
1376
+ /**
1377
+ * D8 — the proof a live-camera image / clip presign carries: a single-use nonce
1378
+ * from `POST /sessions/:id/media/capture-nonces`, plus the capture engine and how
1379
+ * long the capture took. A picked file (or a client without the capture flow)
1380
+ * sends none; the backend then flags (or, in `enforce`, refuses) the upload.
1381
+ */
1382
+ interface CaptureProof {
1383
+ nonce: string;
1384
+ engine?: string;
1385
+ captureMs?: number;
1386
+ }
1387
+ /** D8: `POST /sessions/:id/media/capture-nonces` response. */
1388
+ interface CaptureNoncesResult {
1389
+ nonces: string[];
1390
+ /** Seconds each nonce stays usable. */
1391
+ expiresIn: number;
1392
+ }
1393
+ /** D8: what a capture flow knows about its capture when it presigns. */
1394
+ interface CaptureContext {
1395
+ /** Capture engine id (`v1` / `v3` liveness, `document`, `portrait`). */
1396
+ engine?: string;
1397
+ /** How long the camera capture took, ms (→ `captureMs`; informational). */
1398
+ durationMs?: number;
1399
+ }
1400
+ /** Result of a presign — the presigned PUT URL plus the pending object key. */
1401
+ interface PresignUploadResult {
1402
+ key: string;
1403
+ uploadUrl: string;
1404
+ /** Presign TTL in seconds (900 = 15 min). */
1405
+ expiresIn: number;
1406
+ }
1407
+ /** Result of `POST /sessions/:id/media/complete` — the PROMOTED (class-prefixed) key. */
1408
+ interface CompleteMediaResult {
1409
+ ready: true;
1410
+ /** e.g. `clips/{sessionId}/{uuid}` or `doc-images/{sessionId}/{uuid}` — submit THIS key, not the pending one. */
1411
+ key: string;
1412
+ }
1413
+ /**
1414
+ * Liveness attestation bag (attestation-verifier.service.ts). The web SDK sends
1415
+ * `{channel: 'hosted_web', siteKey, turnstileToken}` — `siteKey` echoes the
1416
+ * `HostedSessionView.turnstileSiteKey` the challenge was rendered with, so the
1417
+ * backend picks the matching widget secret deterministically (Turnstile tokens
1418
+ * are single-use: siteverify runs exactly once, never "org then global").
1419
+ * `sandbox: true` and `signature` are honored only on sandbox sessions;
1420
+ * native SDKs will use platform attestation.
1421
+ */
1422
+ interface AttestationInput {
1423
+ sandbox?: boolean;
1424
+ signature?: string;
1425
+ channel?: "hosted_web";
1426
+ turnstileToken?: string;
1427
+ /** The Turnstile site key the token was minted with (selects the verifying secret). */
1428
+ siteKey?: string;
1429
+ }
1430
+ /**
1431
+ * liveness executor input: a promoted `clips/…` key + optional attestation.
1432
+ * `faceMatch` (v2 latency §3.2) carries the already-promoted `doc-images/…`
1433
+ * keyframe so the backend can run face_match IN THE SAME submission when its
1434
+ * bundle flag is on and `face_match` is the next pending step. Backends that
1435
+ * do not bundle ignore it (the input bag is an open record) — the SDK then
1436
+ * submits `face_match` itself with the same key (see liveness-flow.ts).
1437
+ */
1438
+ interface LivenessInput {
1439
+ clipKey: string;
1440
+ attestation?: AttestationInput;
1441
+ /** Declared capture channel — the liveness band is mobile-calibrated, so the
1442
+ * backend clamps non-mobile verdicts to review (uncalibrated_capture_channel).
1443
+ * Client-declared by design (not a security boundary); absent = legacy
1444
+ * clients, treated as mobile server-side during the rollout window. */
1445
+ captureChannel?: 'mobile' | 'desktop';
1446
+ /** Capture metadata (engine, dimensions, clip length, face-capture timing)
1447
+ * — the backend's allowlisted, non-PII `capture` block (session insights). */
1448
+ capture?: LivenessCaptureInput;
1449
+ /** The promoted face_match probe key, for a bundled liveness + face_match run. */
1450
+ faceMatch?: {
1451
+ imageKey: string;
1452
+ };
1453
+ /**
1454
+ * Step 3 one-capture live photo (flow model 2026-10-23): the ICAO still of the
1455
+ * same capture — exactly the `portrait_icao` body. When `portrait_icao` is the
1456
+ * next pending step the server runs it in parallel with liveness.
1457
+ */
1458
+ portraitIcao?: PortraitIcaoInput;
1459
+ }
1460
+ /** `LivenessInput.capture`: what the SDK's `captured` event measured. All ms are whole, ≥ 0. */
1461
+ interface LivenessCaptureInput {
1462
+ engine?: 'v1' | 'v3';
1463
+ width?: number;
1464
+ height?: number;
1465
+ clipMs?: number;
1466
+ cameraReadyMs?: number;
1467
+ faceAcquireMs?: number;
1468
+ captureMs?: number;
1469
+ /** The camera the clip was filmed with (`environment` = back). */
1470
+ facingMode?: 'user' | 'environment';
1471
+ /**
1472
+ * The capture mode the SDK applied: the session's `capture.mode`, or under `choice` the person's pick
1473
+ * (`Verification.chooseCaptureMode`). The server checks the pick is one the session allows.
1474
+ */
1475
+ mode?: 'self' | 'assisted';
1476
+ /** The device kind. With `mode` set, the server applies the upright requirement (`capture_not_upright`) to `phone` only. */
1477
+ formFactor?: 'phone' | 'tablet' | 'desktop';
1478
+ /**
1479
+ * Liveness v7 §4.5 item 1: the screen ramp the SDK rendered against the session's issued challenge. Absent when no
1480
+ * challenge was issued, in an assisted capture, in a keyframe-only capture, or when no host painted the ramp.
1481
+ */
1482
+ screenRamp?: ScreenRampReport;
1483
+ /** Liveness v7 §4.5 item 2: how the capture was made. Sent whenever the engine had a camera track. */
1484
+ provenance?: CaptureProvenance;
1485
+ }
1486
+ /**
1487
+ * population_registry adapter input. `idNumber` is the national number the
1488
+ * person typed on an UNBOUND session; a session minted with `subject.idNumber`
1489
+ * is BOUND to it: the browser submits `{}` and the backend reads the sealed
1490
+ * value. Sending a DIFFERENT number on a bound session answers 409
1491
+ * `id_number_locked` (formerly `nni_locked`). `nni` is the former name of
1492
+ * `idNumber` (both accepted; both with different values is `400 validation_error`).
1493
+ */
1494
+ interface PopulationInput {
1495
+ idNumber?: string;
1496
+ /** @deprecated Send `idNumber`. */
1497
+ nni?: string;
1498
+ }
1499
+ /**
1500
+ * face_match executor input: a promoted `doc-images/…` key (the source selfie frame).
1501
+ * The same key may already have ridden along as {@link LivenessInput.faceMatch}.
1502
+ */
1503
+ interface FaceMatchInput {
1504
+ imageKey: string;
1505
+ }
1506
+ /** Document side (docs.types.ts DocSide). */
1507
+ type DocSide = "recto" | "verso" | "single";
1508
+ /** The hosted view's `documents` block (2026-11-05): where the ID document step's photo may come from. */
1509
+ interface HostedDocumentsView {
1510
+ /** The step's setting ({@link PhotoSource}). */
1511
+ source: PhotoSource;
1512
+ /** The person's pick under `choice`, once made for this step (do not ask again: a retry, the back side). */
1513
+ sourcePick?: PhotoSourcePick;
1514
+ /**
1515
+ * An upload would be accepted now: `upload`, or `choice` without a camera pick. Never on a camera step, even when
1516
+ * the person's camera cannot open (the step's source is final).
1517
+ */
1518
+ uploadOffered: boolean;
1519
+ }
1520
+ /** doc_ocr executor input: a promoted `doc-images/…` key + which side it shows. */
1521
+ interface DocOcrInput {
1522
+ imageKey: string;
1523
+ side: DocSide;
1524
+ /**
1525
+ * Web live MRZ (spec 2026-10-21 D6): the device-read HINT of a live-MRZ capture — where the MRZ is in the uploaded
1526
+ * image and that every hard check digit validated on the device. Geometry, a format, counts and a salted digest
1527
+ * only (never MRZ text); the server re-reads the pixels and decides. Omitted when not ready at POST time.
1528
+ */
1529
+ deviceRead?: DocDeviceRead;
1530
+ /**
1531
+ * 2026-11-05: `upload` when the photo was picked from the device instead of taken with the camera (only while the
1532
+ * view's `documents.uploadOffered`; else 400 `document_upload_not_allowed`). Absent = `camera`.
1533
+ */
1534
+ source?: PhotoSourcePick;
1535
+ }
1536
+ /** The `doc_ocr` device-read hint (identity-backend DeviceReadSchema; strict, text-free). */
1537
+ interface DocDeviceRead {
1538
+ engine: string;
1539
+ source: "live_mrz";
1540
+ format: "TD1" | "TD2" | "TD3";
1541
+ lineCount: number;
1542
+ checkDigitsValid: true;
1543
+ stillConfirmed?: boolean;
1544
+ /** [x, y, w, h] normalized to the uploaded image. */
1545
+ band: [number, number, number, number];
1546
+ /** sha256("sekyro-mrz-1\0" + sessionId + "\0" + canonical MRZ lines), 64 hex. */
1547
+ digest: string;
1548
+ framesToValid: number;
1549
+ msToValid: number;
1550
+ }
1551
+ /** How the digits of a national number group while typing (phone rules spec 2026-11-02 §2.1). */
1552
+ interface PhoneFormat {
1553
+ /** A pattern over the national digits, matched anchored at the start. */
1554
+ leading: string;
1555
+ /** Digits per block; the sum is one of the rule's `lengths`. */
1556
+ groups: number[];
1557
+ }
1558
+ /** The numbering plan of one accepted country, derived from libphonenumber metadata on the server (spec §2.1). */
1559
+ interface PhoneCountryRule {
1560
+ /** ISO alpha-2, an entry of the step's `phoneCountries`. */
1561
+ code: string;
1562
+ /** The calling code's digits, without `+`. */
1563
+ dial: string;
1564
+ /** National prefix a person may type first and the client drops; absent when the country has none. */
1565
+ trunk?: string;
1566
+ /** The valid national number lengths, ascending. */
1567
+ lengths: number[];
1568
+ /** Digit grouping; absent when the plan has too many formats or none usable. */
1569
+ formats?: PhoneFormat[];
1570
+ }
1571
+ /**
1572
+ * phone_otp executor input (Task 13): a two-phase check. `send` dispatches (or
1573
+ * resends) an OTP — resolving the number from the trusted server-side prefill
1574
+ * or the user-entered `phone` per the step's `numberSource`; `verify` checks
1575
+ * the entered `code` against the parked token. `phone` is IGNORED for a
1576
+ * `prefilled` step (a client number is never trusted as "prefilled").
1577
+ */
1578
+ interface PhoneOtpInput {
1579
+ /** Phase selector: `send` dispatches/resends, `verify` checks the code. Defaults to `send`. */
1580
+ action: "send" | "verify";
1581
+ /** USER-entered E.164 number (`user_entered` / `prefilled_or_entered` sends only). */
1582
+ phone?: string;
1583
+ /** The code the user typed — `verify` only. */
1584
+ code?: string;
1585
+ /**
1586
+ * Phone rules spec 2026-11-02 §2.3: this client applied the server's rules and understands
1587
+ * `otp_number_invalid` and `otp_number_not_mobile`. `send` only.
1588
+ */
1589
+ phoneRules?: 1;
1590
+ /**
1591
+ * The channel the person chose for `send`. Must be one of the step's
1592
+ * `otp.channels` when the view lists them; a session without channels
1593
+ * defaults to `sms`.
1594
+ */
1595
+ channel?: "sms" | "whatsapp";
1596
+ /** OTP message locale override for `send`. */
1597
+ locale?: "ar" | "fr" | "en";
1598
+ }
1599
+ /**
1600
+ * email_otp executor input (Plan 8, profile v2 §4.6.5): `send` emails a code to
1601
+ * the trusted prefill or the user-entered `email` (per `emailOtp.emailSource`;
1602
+ * ignored for `prefilled`), `verify` checks the entered `code`.
1603
+ */
1604
+ interface EmailOtpInput {
1605
+ /** Phase selector: `send` dispatches/resends, `verify` checks the code. */
1606
+ action: "send" | "verify";
1607
+ /** USER-entered address (`user_entered` / `prefilled_or_entered` sends only). */
1608
+ email?: string;
1609
+ /** The code the user typed — `verify` only. */
1610
+ code?: string;
1611
+ /** Email copy locale override for `send`. */
1612
+ locale?: "ar" | "fr" | "en";
1613
+ }
1614
+ /**
1615
+ * portrait_icao executor input (SDK spec §4.9): the ICAO gate's frame
1616
+ * (uploaded as media kind `image`). The server re-runs every criterion; only
1617
+ * `gate.baselineEyeOpenness` (0–1, the user's own eye-openness baseline) is used.
1618
+ */
1619
+ interface PortraitIcaoInput {
1620
+ media: {
1621
+ portrait: string;
1622
+ };
1623
+ gate?: {
1624
+ baselineEyeOpenness?: number;
1625
+ /**
1626
+ * The device verdict on the submitted still, with the server's criterion names
1627
+ * (`framing` folds into `resolution`; unmeasured criteria are omitted, and
1628
+ * `background` when the profile does not require it). Compared with the server
1629
+ * report, never trusted. Values are booleans keyed by {@link IcaoCriterion}
1630
+ * (the 0.1 type is kept: the public API only grows).
1631
+ */
1632
+ criteria?: Record<string, unknown>;
1633
+ /** The client background-uniformity measurement (numbers only; telemetry — the server decides). */
1634
+ backgroundCheck?: Record<string, unknown>;
1635
+ };
1636
+ tuningVersion?: string;
1637
+ /**
1638
+ * Design 2026-11-04 §6.2: `camera` for a photo the portrait camera took, `upload` for a photo picked from the device
1639
+ * (presigned as a declared upload, no capture proof). Absent = `camera`.
1640
+ */
1641
+ source?: PhotoSourcePick;
1642
+ /** The capture mode the portrait camera ran in (the step's, or the person's pick under `choice`). Camera only. */
1643
+ capture?: {
1644
+ mode: ResolvedCaptureMode;
1645
+ };
1646
+ }
1647
+ /**
1648
+ * eid_auth executor input (SDK spec §3.2): `start` asks the provider for a
1649
+ * code (with the person's `identifier` — the NNI in MR — unless the session is
1650
+ * bound to it), `verify` checks the typed `code`, `resend` asks for a new code.
1651
+ * On a bound session a different `identifier` answers 409 `nni_locked`.
1652
+ */
1653
+ interface EidAuthInput {
1654
+ action: "start" | "verify" | "resend";
1655
+ /** `start` only: the national number, omitted on a bound session. */
1656
+ identifier?: string;
1657
+ /** `verify` only: the code shown in the provider's app. */
1658
+ code?: string;
1659
+ }
1660
+ /**
1661
+ * The person's answer to an adjusted portrait (design 2026-11-04 §6.4 step 4), submitted as `portrait_icao` while
1662
+ * `HostedSessionView.portrait.pendingFix` is present: `accept: true` uses the adjusted photo, `false` ends the attempt
1663
+ * (`portrait_declined_fix`, not billed).
1664
+ */
1665
+ interface PortraitFixReviewInput {
1666
+ fixReview: {
1667
+ accept: boolean;
1668
+ };
1669
+ }
1670
+ /** Per-check-type submission input shapes, keyed by the frozen vocabulary. */
1671
+ interface CheckInputByType {
1672
+ liveness: LivenessInput;
1673
+ face_match: FaceMatchInput;
1674
+ doc_ocr: DocOcrInput;
1675
+ population_registry: PopulationInput;
1676
+ phone_otp: PhoneOtpInput;
1677
+ /** M-nfc: read and submitted by the native SDKs only — the web never submits it. */
1678
+ nfc_chip: never;
1679
+ email_otp: EmailOtpInput;
1680
+ /** SDK spec §4.9: the web ICAO gate ships with M1b; the shape is ready for headless use. */
1681
+ portrait_icao: PortraitIcaoInput;
1682
+ /** SDK spec §3.2: the national eID sign-in. */
1683
+ eid_auth: EidAuthInput;
1684
+ }
1685
+ /**
1686
+ * Body of `POST /sessions/:id/checks/:checkType` (SubmitCheckSchema).
1687
+ * `forceOutcome` is SANDBOX-ONLY (plan D-C) — a live session rejects it with
1688
+ * 403 `force_outcome_forbidden`.
1689
+ */
1690
+ interface SubmitCheckBody {
1691
+ input?: Record<string, unknown>;
1692
+ /**
1693
+ * `age_over | age_uncertain | age_under | age_unavailable` (liveness submit only) pick what the age check
1694
+ * (selfie) step that follows the liveness step decides in a sandbox session.
1695
+ */
1696
+ forceOutcome?: "pass" | "fail" | "age_over" | "age_uncertain" | "age_under" | "age_unavailable";
1697
+ }
1698
+
1699
+ export { type LivenessCaptureInput as $, type AcceptedDocumentType as A, type HostedEmailOtpView as B, type CaptureContext as C, type DecisionReason as D, type EidAfterPass as E, type FaceMatchInput as F, type HostedFlowRef as G, type HostedAcceptedDocuments as H, type HostedIcaoPolicy as I, type HostedIntegrity as J, type HostedLivePhotoTuning as K, type HostedNativeCaptureTuning as L, type HostedOcrTuning as M, type HostedOtpView as N, type HostedPlanView as O, type HostedPortraitPendingFix as P, type HostedPortraitView as Q, type HostedSessionView as R, type HostedStepView as S, type HostedVoiceLocale as T, type HostedVoiceView as U, type IcaoCriterion as V, type IcaoReportEntry as W, type IdentityConfirmDecision as X, type IdentityMethod as Y, type IdentitySummarySource as Z, type IdentitySummaryView as _, type AttestationInput as a, type LivenessInput as a0, type LivenessReason as a1, type MatchReason as a2, type MediaKind as a3, type MethodChoiceView as a4, type NationalEidOption as a5, type NfcChipReason as a6, type NfcStepView as a7, type OtpChoiceView as a8, type PhoneCountryRule as a9, type SessionStepView as aA, type SessionView as aB, type StepSection as aC, type SubmitCheckBody as aD, type VerificationAssurance as aE, type VerificationLevel as aF, type ScreenRampColour as aG, type AgeEstimationReason as aH, type CameraUnavailableCause as aI, type CaptureIssueReport as aJ, type CaptureProvenance as aK, type HostedBranding as aL, type HostedBrandingColorKey as aM, type HostedLivenessCaptureTuning as aN, type IcaoCaptureTuning as aO, type RetakeHint as aP, type ScreenRampChallenge as aQ, type ScreenRampRendered as aR, type ScreenRampReport as aS, ICAO_FALLBACK as aT, type IcaoProfile as aU, type ResolvedIcaoTuning as aV, resolveIcaoTuning as aW, type PersonMask as aX, type BackgroundUniformity as aY, type PhoneFormat as aa, type PhoneOtpInput as ab, type PhoneOtpReason as ac, type PhotoSource as ad, type PhotoSourcePick as ae, type PlanAttempts as af, type PlanChoiceKind as ag, type PlanChoiceOption as ah, type PlanChoiceView as ai, type PlanSectionView as aj, type PlanStepView as ak, type PolicyFailureReason as al, type PopulationInput as am, type PopulationReason as an, type PortraitFix as ao, type PortraitFixReviewInput as ap, type PortraitIcaoInput as aq, type PortraitIcaoReason as ar, type PortraitOutputFormat as as, type PresignRequest as at, type PresignUploadResult as au, type RecordConsentResult as av, type ResolvedCaptureMode as aw, type SessionFailureReason as ax, type SessionOutcome as ay, type SessionStatus as az, type CaptureMode as b, 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 CompleteMediaResult as i, type ConsentLocale as j, type ContactChannel as k, type DocDeviceRead as l, type DocOcrInput as m, type DocReason as n, type DocSide as o, type EidAuthInput as p, type EidReason as q, type EmailOtpInput as r, type EmailOtpReason as s, type FaceMatchReason as t, type HostedCaptureTuning as u, type HostedConsentView as v, type HostedDocumentCaptureTuning as w, type HostedDocumentScanTuning as x, type HostedDocumentsView as y, type HostedEidView as z };