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

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