@sekyro/web 0.1.0-rc.5 → 0.1.0-rc.7

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 (67) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +3 -3
  3. package/README.md +4 -4
  4. package/dist/chunk-B45J4KC3.js +1 -0
  5. package/dist/chunk-BMA36W2W.js +1 -0
  6. package/dist/chunk-FPXL63KZ.js +1 -0
  7. package/dist/chunk-IYUOYINS.js +1 -0
  8. package/dist/chunk-P7ECRN47.js +1 -0
  9. package/dist/chunk-SXZCL5NO.js +1 -0
  10. package/dist/chunk-YOB4ZTYN.js +1 -0
  11. package/dist/chunk-YQBK6OIM.js +1 -0
  12. package/dist/client/index.cjs +1 -357
  13. package/dist/client/index.d.cts +2 -2
  14. package/dist/client/index.d.ts +2 -2
  15. package/dist/client/index.js +1 -15
  16. package/dist/core/index.cjs +1 -1639
  17. package/dist/core/index.js +1 -139
  18. package/dist/core/v3/detect-worker.cjs +1 -392
  19. package/dist/core/v3/detect-worker.js +1 -13
  20. package/dist/{create-verification-CA-3szPI.d.cts → create-verification-C2JhOO6Y.d.cts} +100 -15
  21. package/dist/{create-verification-c98uAxbl.d.ts → create-verification-CGazwtAh.d.ts} +100 -15
  22. package/dist/detector-scanic-VQFFXKTL.js +1 -0
  23. package/dist/{hosted-client-DWzCRYJK.d.ts → hosted-client-kBeq-mnJ.d.cts} +188 -7
  24. package/dist/{hosted-client-DWzCRYJK.d.cts → hosted-client-kBeq-mnJ.d.ts} +188 -7
  25. package/dist/index.cjs +1 -3020
  26. package/dist/index.d.cts +2 -2
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.js +1 -85
  29. package/dist/internal/index.cjs +1 -4429
  30. package/dist/internal/index.d.cts +10 -7
  31. package/dist/internal/index.d.ts +10 -7
  32. package/dist/internal/index.js +1 -657
  33. package/dist/popup/index.cjs +1 -76
  34. package/dist/popup/index.js +1 -11
  35. package/dist/scanic-ml-stub-KW7IZHUT.js +1 -0
  36. package/package.json +5 -8
  37. package/sbom.cdx.json +195 -0
  38. package/dist/chunk-MWNFSNMP.js +0 -52
  39. package/dist/chunk-MWNFSNMP.js.map +0 -1
  40. package/dist/chunk-NILNKLK6.js +0 -50
  41. package/dist/chunk-NILNKLK6.js.map +0 -1
  42. package/dist/chunk-NWF46H7K.js +0 -359
  43. package/dist/chunk-NWF46H7K.js.map +0 -1
  44. package/dist/chunk-SGDXLAXR.js +0 -1163
  45. package/dist/chunk-SGDXLAXR.js.map +0 -1
  46. package/dist/chunk-TG5IE552.js +0 -1128
  47. package/dist/chunk-TG5IE552.js.map +0 -1
  48. package/dist/chunk-WY6U7AIK.js +0 -193
  49. package/dist/chunk-WY6U7AIK.js.map +0 -1
  50. package/dist/chunk-YVFF4Q4G.js +0 -327
  51. package/dist/chunk-YVFF4Q4G.js.map +0 -1
  52. package/dist/client/index.cjs.map +0 -1
  53. package/dist/client/index.js.map +0 -1
  54. package/dist/core/index.cjs.map +0 -1
  55. package/dist/core/index.js.map +0 -1
  56. package/dist/core/v3/detect-worker.cjs.map +0 -1
  57. package/dist/core/v3/detect-worker.js.map +0 -1
  58. package/dist/detector-scanic-4C6IEW2K.js +0 -787
  59. package/dist/detector-scanic-4C6IEW2K.js.map +0 -1
  60. package/dist/index.cjs.map +0 -1
  61. package/dist/index.js.map +0 -1
  62. package/dist/internal/index.cjs.map +0 -1
  63. package/dist/internal/index.js.map +0 -1
  64. package/dist/popup/index.cjs.map +0 -1
  65. package/dist/popup/index.js.map +0 -1
  66. package/dist/scanic-ml-stub-S2OZ6HEF.js +0 -10
  67. package/dist/scanic-ml-stub-S2OZ6HEF.js.map +0 -1
@@ -6,10 +6,26 @@ type SessionOutcome = "approved" | "review" | "rejected";
6
6
  type CheckState = "pending" | "input_required" | "processing" | "passed" | "failed" | "review" | "skipped";
7
7
  /** The frozen check-type vocabulary (CHECK_TYPES). `phone_otp` joined in Task 13. */
8
8
  type CheckType = "liveness" | "face_match" | "doc_ocr" | "population_registry" | "phone_otp";
9
- type LivenessReason = "no_face" | "media_unreadable" | "clip_too_short" | "spoof_detected" | "review_band";
10
- type PopulationReason = "nni_not_found" | "nni_invalid" | "registry_unavailable" | "result_from_cache";
11
- type FaceMatchReason = "no_face_source" | "no_face_reference" | "low_quality_reference" | "below_threshold" | "review_band";
12
- type DocReason = "side_missing" | "mrz_checksum_failed" | "unreadable" | "expired_document" | "authenticity_review" | "registry_mismatch";
9
+ type LivenessReason = "no_face" | "media_unreadable" | "clip_too_short" | "spoof_detected" | "review_band" | "liveness_inconclusive" | "mobile_required" | "uncalibrated_capture_channel";
10
+ type PopulationReason = "nni_not_found" | "nni_invalid" | "registry_unavailable" | "result_from_cache" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch";
11
+ type FaceMatchReason = "no_face_source" | "no_face_reference" | "low_quality_reference" | "below_threshold" | "review_band" | "match_inconclusive";
12
+ type DocReason = "side_missing" | "mrz_checksum_failed" | "unreadable" | "expired_document" | "authenticity_review" | "document_authenticity" | "registry_mismatch" | "document_nni_mismatch" | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "document_number_mismatch";
13
+ /**
14
+ * Profile v2 step 3 matching reasons: a field the partner sent at session
15
+ * create (`subject`) differs from the reference identity (document or
16
+ * registry). All four are final. `document_number_mismatch` is `doc_ocr` only.
17
+ */
18
+ type MatchReason = "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "document_number_mismatch";
19
+ /**
20
+ * Profile v2 step 4 decision-mode reasons (the app decides automatically
21
+ * instead of sending the case to human review). These park the step at
22
+ * `input_required` while attempts remain: `liveness_inconclusive` /
23
+ * `match_inconclusive` (middle score band) and `document_authenticity`
24
+ * (retake the original card). `mobile_required` is kept for compatibility:
25
+ * the backend now answers a non-phone capture with a request-level
26
+ * `409 mobile_required` (continue on a phone; nothing used, not billed).
27
+ */
28
+ type DecisionReason = "liveness_inconclusive" | "match_inconclusive" | "document_authenticity" | "mobile_required";
13
29
  /**
14
30
  * phone_otp reasons (Task 13). All transient — the caller fixes them by
15
31
  * re-entering / resending: `otp_mismatch` (wrong or missing code),
@@ -23,6 +39,49 @@ type PhoneOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed";
23
39
  * and face_match both carry `review_band`.
24
40
  */
25
41
  type CheckReason = LivenessReason | PopulationReason | FaceMatchReason | DocReason | PhoneOtpReason;
42
+ /**
43
+ * Session-level failure reasons: the session was stopped by a policy gate,
44
+ * not by a failed check. All are terminal (no retry on this session):
45
+ * - `location_not_allowed` / `anonymizer_blocked` (profile v2 step 2): the
46
+ * person's IP location is not allowed, or an anonymizer (VPN / proxy / Tor)
47
+ * was detected while the app blocks them;
48
+ * - `capture_tampered` (step 4): the device reported a tampered capture
49
+ * (virtual camera, hooking, emulator…) while the app blocks it;
50
+ * - `device_velocity_exceeded` (step 4): this device already verified too
51
+ * many different people while the app blocks it;
52
+ * - `device_cooldown` (step 4): this device had too many rejected sessions —
53
+ * {@link HostedSessionView.retryAfter} says when it may try again.
54
+ */
55
+ type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown";
56
+ /**
57
+ * The profile-v2 policy reasons a session can end on: the two session-level
58
+ * reasons plus the failed check's policy reasons (`document_type_not_accepted`,
59
+ * `nationality_not_allowed`, `underage`, `age_unverifiable`,
60
+ * `document_nni_mismatch`).
61
+ */
62
+ type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "document_nni_mismatch";
63
+ /**
64
+ * How the person proves their identity when the app makes the document
65
+ * optional for registry nationals (profile v2 step 3): type their national
66
+ * number (NNI) and skip the document, or photograph their document.
67
+ */
68
+ type IdentityMethod = "national_number" | "document_photo";
69
+ /**
70
+ * The identity-method choice of a session (`HostedSessionView.methodChoice`).
71
+ * While `available && selected === null` no check can be submitted (409
72
+ * `method_required`): the page asks first and sends the answer with
73
+ * `POST /hosted/method` ({@link HostedClient.selectMethod}).
74
+ */
75
+ interface MethodChoiceView {
76
+ /** The session offers the choice (the app's document mode is `optional`). */
77
+ available: boolean;
78
+ /** The chosen method, or `null` while the person has not chosen. */
79
+ selected: IdentityMethod | null;
80
+ /** The methods to offer, in display order. */
81
+ options: IdentityMethod[];
82
+ }
83
+ /** A document type the backend reads today (kyc-docs-v2 vocabulary). */
84
+ type AcceptedDocumentType = "carte_identite" | "passport";
26
85
  /**
27
86
  * phone_otp DISPLAY-SAFE surface (Task 16). The backend stashes the OTP
28
87
  * service `verifToken` on the check's persisted outputs (the doc_ocr partial
@@ -66,6 +125,67 @@ interface HostedStepView {
66
125
  acceptedSides?: ("recto" | "verso")[];
67
126
  /** phone_otp only: the display-safe OTP send/config surface (never the verifToken). */
68
127
  otp?: HostedOtpView;
128
+ /**
129
+ * The check failed after using all of its attempts — no retry is left.
130
+ * Absent on older APIs (treat absent as `false`).
131
+ */
132
+ attemptsExhausted?: boolean;
133
+ /**
134
+ * population_registry only: the session is not bound to an NNI, but the
135
+ * document step already read a valid one — the page submits the registry
136
+ * check with an EMPTY input (no NNI field) and the backend uses the
137
+ * document's number. Absent on older APIs.
138
+ */
139
+ nniFromDocument?: boolean;
140
+ /**
141
+ * liveness / face_match (profile v2 step 4, decision mode `automatic`): the
142
+ * capture must come from a phone — the liveness band is calibrated on
143
+ * mobile captures only. A desktop page hands the person off to their phone
144
+ * instead of capturing (a desktop submission answers `mobile_required`).
145
+ * Absent on older APIs and in `review` mode.
146
+ */
147
+ requiresMobile?: boolean;
148
+ }
149
+ /** A locale the Sekyro AI-hosted voice clips are recorded in. */
150
+ type HostedVoiceLocale = "ar" | "fr" | "en";
151
+ /**
152
+ * The session's Sekyro AI-hosted voice-guidance clips (the active clip set).
153
+ *
154
+ * `clips[locale]` maps a voice key (`fcv3.*`, the `@sekyro/react` voice-key
155
+ * namespace) to an ABSOLUTE URL on the Sekyro AI assets host
156
+ * (`https://assets.sekyro.ai/voice/<setId>/<locale>/<name>.mp3`; staging:
157
+ * `assets-staging.sekyro.ai`). URLs are immutable per `setId`. A locale or key
158
+ * may be missing — the player falls back to the device voice for it.
159
+ *
160
+ * A page with a Content-Security-Policy must allow the assets origin in
161
+ * `media-src` for the clips to play (see the partner web-SDK guide, CSP note).
162
+ */
163
+ interface HostedVoiceView {
164
+ /** Identifier of the active clip set (part of every clip URL). */
165
+ setId: string;
166
+ /** Per-locale map of voice key (`fcv3.*`) → absolute clip URL. */
167
+ clips: {
168
+ readonly [L in HostedVoiceLocale]?: Readonly<Record<string, string>>;
169
+ };
170
+ }
171
+ /** A branding colour key (each value is `#rrggbb`). */
172
+ type HostedBrandingColorKey = "brand" | "brandFg" | "bg" | "surface" | "fg" | "fgMuted" | "danger" | "success" | "warning";
173
+ /**
174
+ * The org / app branding of a session (`HostedSessionView.branding`): only the
175
+ * fields set in the dashboard, merged per field (app over org). A field the
176
+ * org and app left unset is ABSENT — keep your default for it; the whole
177
+ * object is absent when nothing is set. `logoUrl` is a short-lived signed URL
178
+ * (15 minutes).
179
+ */
180
+ interface HostedBranding {
181
+ /** Signed URL of the logo (PNG or sanitized SVG); absent when none is set. */
182
+ logoUrl?: string;
183
+ /** Colours as `#rrggbb`. */
184
+ colors?: Partial<Record<HostedBrandingColorKey, string>>;
185
+ /** Corner radius step. */
186
+ radius?: "none" | "sm" | "md" | "lg" | "full";
187
+ /** Font choice (system fallbacks when the font is not installed). */
188
+ fontFamily?: "system" | "inter" | "ibm-plex-sans-arabic" | "noto-sans-arabic" | "roboto";
69
189
  }
70
190
  /**
71
191
  * Token-addressed hosted-page bootstrap (`GET /hosted/session`). A separate
@@ -110,6 +230,41 @@ interface HostedSessionView {
110
230
  * valid (additive field, always on the wire from Task 8 onward).
111
231
  */
112
232
  nniBound?: boolean;
233
+ /**
234
+ * The Sekyro AI-hosted voice-guidance clips of this session, or `null` when no
235
+ * clip set is active (the device voice is used). Optional: older APIs omit
236
+ * the field — treat absent like `null`.
237
+ */
238
+ voice?: HostedVoiceView | null;
239
+ /**
240
+ * Why the session ended, when a profile-v2 policy stopped it: a
241
+ * {@link SessionFailureReason}, or the failed check's reason when it is a
242
+ * policy reason (eligibility, or `document_nni_mismatch`). Absent otherwise
243
+ * (and on older APIs).
244
+ */
245
+ failureReason?: PolicyFailureReason;
246
+ /**
247
+ * The document types the person may pick (resolved for issuer `MR`). Absent
248
+ * on older APIs — treat absent as every type (`carte_identite`, `passport`).
249
+ */
250
+ acceptedDocumentTypes?: AcceptedDocumentType[];
251
+ /**
252
+ * The identity-method choice (profile v2 step 3). Absent when the session
253
+ * has no choice (and on older APIs). While `available && selected === null`
254
+ * every check submission answers 409 `method_required`.
255
+ */
256
+ methodChoice?: MethodChoiceView;
257
+ /**
258
+ * ISO-8601 time from which this device may verify again — set with
259
+ * `failureReason: 'device_cooldown'` (profile v2 step 4). Absent otherwise
260
+ * (and on older APIs).
261
+ */
262
+ retryAfter?: string;
263
+ /**
264
+ * The org / app branding (settings spec §5.1). Absent on older APIs — keep
265
+ * the default theme. Map it with `brandingToTheme()` from `@sekyro/react`.
266
+ */
267
+ branding?: HostedBranding;
113
268
  }
114
269
  /** `POST /hosted/consent` result — 201 on first record, 200 `{alreadyRecorded: true}` on replay. */
115
270
  interface RecordConsentResult {
@@ -123,6 +278,8 @@ interface SessionStepView {
123
278
  state: CheckState;
124
279
  reason?: CheckReason;
125
280
  calibratedScore?: number;
281
+ /** The check failed after using all of its attempts. Absent on older APIs. */
282
+ attemptsExhausted?: boolean;
126
283
  }
127
284
  /**
128
285
  * Client-facing session projection returned by
@@ -132,6 +289,8 @@ interface SessionView {
132
289
  id: string;
133
290
  status: SessionStatus;
134
291
  outcome: SessionOutcome | null;
292
+ /** Profile-v2 policy stop reason; absent on ordinary failures and older APIs. */
293
+ failureReason?: PolicyFailureReason;
135
294
  steps: SessionStepView[];
136
295
  /** ISO-8601 timestamp (Date on the server, string on the wire). */
137
296
  expiresAt: string;
@@ -181,7 +340,14 @@ interface AttestationInput {
181
340
  /** The Turnstile site key the token was minted with (selects the verifying secret). */
182
341
  siteKey?: string;
183
342
  }
184
- /** liveness executor input: a promoted `clips/…` key + optional attestation. */
343
+ /**
344
+ * liveness executor input: a promoted `clips/…` key + optional attestation.
345
+ * `faceMatch` (v2 latency §3.2) carries the already-promoted `doc-images/…`
346
+ * keyframe so the backend can run face_match IN THE SAME submission when its
347
+ * bundle flag is on and `face_match` is the next pending step. Backends that
348
+ * do not bundle ignore it (the input bag is an open record) — the SDK then
349
+ * submits `face_match` itself with the same key (see liveness-flow.ts).
350
+ */
185
351
  interface LivenessInput {
186
352
  clipKey: string;
187
353
  attestation?: AttestationInput;
@@ -193,6 +359,10 @@ interface LivenessInput {
193
359
  /** Capture metadata (engine, dimensions, clip length, face-capture timing)
194
360
  * — the backend's allowlisted, non-PII `capture` block (session insights). */
195
361
  capture?: LivenessCaptureInput;
362
+ /** The promoted face_match probe key, for a bundled liveness + face_match run. */
363
+ faceMatch?: {
364
+ imageKey: string;
365
+ };
196
366
  }
197
367
  /** `LivenessInput.capture`: what the SDK's `captured` event measured. All ms are whole, ≥ 0. */
198
368
  interface LivenessCaptureInput {
@@ -213,7 +383,10 @@ interface LivenessCaptureInput {
213
383
  interface PopulationInput {
214
384
  nni?: string;
215
385
  }
216
- /** face_match executor input: a promoted `doc-images/…` key (the source selfie frame). */
386
+ /**
387
+ * face_match executor input: a promoted `doc-images/…` key (the source selfie frame).
388
+ * The same key may already have ridden along as {@link LivenessInput.faceMatch}.
389
+ */
217
390
  interface FaceMatchInput {
218
391
  imageKey: string;
219
392
  }
@@ -320,6 +493,7 @@ interface HostedClientOptions {
320
493
  *
321
494
  * GET /api/v2/hosted/session → {@link getSession}
322
495
  * POST /api/v2/hosted/consent → {@link recordConsent}
496
+ * POST /api/v2/hosted/method → {@link selectMethod}
323
497
  * POST /api/v2/sessions/:id/media → {@link presign}
324
498
  * POST /api/v2/sessions/:id/media/complete → {@link completeMedia}
325
499
  * POST /api/v2/sessions/:id/checks/:checkType → {@link submitCheck}
@@ -358,6 +532,13 @@ declare class HostedClient {
358
532
  * submission answer 409 `consent_required`.
359
533
  */
360
534
  recordConsent(locale: ConsentLocale): Promise<RecordConsentResult>;
535
+ /**
536
+ * Send the person's identity method (profile v2 step 3) when the view offers
537
+ * a choice (`methodChoice.available`). Returns the updated hosted view —
538
+ * continue from it. 409 `method_locked` when the method can no longer
539
+ * change (a check of the chosen method was already submitted).
540
+ */
541
+ selectMethod(method: IdentityMethod): Promise<HostedSessionView>;
361
542
  /**
362
543
  * Presign a Spaces PUT for a new pending object. `contentType` is stripped of
363
544
  * MIME parameters defensively (the allowlist holds bare types; the engine's
@@ -418,4 +599,4 @@ declare class HostedClient {
418
599
  private api;
419
600
  }
420
601
 
421
- export { type AttestationInput as A, type CheckReason as C, type DocReason as D, type FaceMatchReason as F, type HostedOtpView as H, type LivenessReason as L, type MediaCheckType as M, type PhoneOtpReason as P, type RecordConsentResult as R, type SessionOutcome as S, type UploadMedia as U, type CheckState as a, type CheckType as b, type HostedSessionView as c, type HostedStepView as d, type PopulationReason as e, type SessionStatus as f, HostedClient as g, type SessionView as h, type CheckInputByType as i, type CompleteMediaResult as j, type ConsentLocale as k, type DocOcrInput as l, type DocSide as m, type FaceMatchInput as n, type HostedClientOptions as o, type LivenessCaptureInput as p, type LivenessInput as q, type MediaKind as r, type PhoneOtpInput as s, type PopulationInput as t, type PresignRequest as u, type PresignUploadResult as v, type SessionStepView as w, type SubmitCheckBody as x, type SubmitOptions as y, stripMimeParams as z };
602
+ export { type AcceptedDocumentType as A, type MediaCheckType as B, type CheckReason as C, type DecisionReason as D, type MediaKind as E, type FaceMatchReason as F, type PhoneOtpInput as G, type HostedBranding as H, type IdentityMethod as I, type PopulationInput as J, type PresignRequest as K, type LivenessReason as L, type MatchReason as M, type PresignUploadResult as N, type SessionStepView as O, type PhoneOtpReason as P, type SubmitCheckBody as Q, type RecordConsentResult as R, type SessionFailureReason as S, type SubmitOptions as T, type UploadMedia as U, stripMimeParams as V, type CheckState as a, type CheckType as b, type DocReason as c, type HostedBrandingColorKey as d, type HostedOtpView as e, type HostedSessionView as f, type HostedStepView as g, type HostedVoiceLocale as h, type HostedVoiceView as i, type MethodChoiceView as j, type PolicyFailureReason as k, type PopulationReason as l, type SessionOutcome as m, type SessionStatus as n, HostedClient as o, type AttestationInput as p, type SessionView as q, type CheckInputByType as r, type CompleteMediaResult as s, type ConsentLocale as t, type DocOcrInput as u, type DocSide as v, type FaceMatchInput as w, type HostedClientOptions as x, type LivenessCaptureInput as y, type LivenessInput as z };
@@ -6,10 +6,26 @@ type SessionOutcome = "approved" | "review" | "rejected";
6
6
  type CheckState = "pending" | "input_required" | "processing" | "passed" | "failed" | "review" | "skipped";
7
7
  /** The frozen check-type vocabulary (CHECK_TYPES). `phone_otp` joined in Task 13. */
8
8
  type CheckType = "liveness" | "face_match" | "doc_ocr" | "population_registry" | "phone_otp";
9
- type LivenessReason = "no_face" | "media_unreadable" | "clip_too_short" | "spoof_detected" | "review_band";
10
- type PopulationReason = "nni_not_found" | "nni_invalid" | "registry_unavailable" | "result_from_cache";
11
- type FaceMatchReason = "no_face_source" | "no_face_reference" | "low_quality_reference" | "below_threshold" | "review_band";
12
- type DocReason = "side_missing" | "mrz_checksum_failed" | "unreadable" | "expired_document" | "authenticity_review" | "registry_mismatch";
9
+ type LivenessReason = "no_face" | "media_unreadable" | "clip_too_short" | "spoof_detected" | "review_band" | "liveness_inconclusive" | "mobile_required" | "uncalibrated_capture_channel";
10
+ type PopulationReason = "nni_not_found" | "nni_invalid" | "registry_unavailable" | "result_from_cache" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch";
11
+ type FaceMatchReason = "no_face_source" | "no_face_reference" | "low_quality_reference" | "below_threshold" | "review_band" | "match_inconclusive";
12
+ type DocReason = "side_missing" | "mrz_checksum_failed" | "unreadable" | "expired_document" | "authenticity_review" | "document_authenticity" | "registry_mismatch" | "document_nni_mismatch" | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "document_number_mismatch";
13
+ /**
14
+ * Profile v2 step 3 matching reasons: a field the partner sent at session
15
+ * create (`subject`) differs from the reference identity (document or
16
+ * registry). All four are final. `document_number_mismatch` is `doc_ocr` only.
17
+ */
18
+ type MatchReason = "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "document_number_mismatch";
19
+ /**
20
+ * Profile v2 step 4 decision-mode reasons (the app decides automatically
21
+ * instead of sending the case to human review). These park the step at
22
+ * `input_required` while attempts remain: `liveness_inconclusive` /
23
+ * `match_inconclusive` (middle score band) and `document_authenticity`
24
+ * (retake the original card). `mobile_required` is kept for compatibility:
25
+ * the backend now answers a non-phone capture with a request-level
26
+ * `409 mobile_required` (continue on a phone; nothing used, not billed).
27
+ */
28
+ type DecisionReason = "liveness_inconclusive" | "match_inconclusive" | "document_authenticity" | "mobile_required";
13
29
  /**
14
30
  * phone_otp reasons (Task 13). All transient — the caller fixes them by
15
31
  * re-entering / resending: `otp_mismatch` (wrong or missing code),
@@ -23,6 +39,49 @@ type PhoneOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed";
23
39
  * and face_match both carry `review_band`.
24
40
  */
25
41
  type CheckReason = LivenessReason | PopulationReason | FaceMatchReason | DocReason | PhoneOtpReason;
42
+ /**
43
+ * Session-level failure reasons: the session was stopped by a policy gate,
44
+ * not by a failed check. All are terminal (no retry on this session):
45
+ * - `location_not_allowed` / `anonymizer_blocked` (profile v2 step 2): the
46
+ * person's IP location is not allowed, or an anonymizer (VPN / proxy / Tor)
47
+ * was detected while the app blocks them;
48
+ * - `capture_tampered` (step 4): the device reported a tampered capture
49
+ * (virtual camera, hooking, emulator…) while the app blocks it;
50
+ * - `device_velocity_exceeded` (step 4): this device already verified too
51
+ * many different people while the app blocks it;
52
+ * - `device_cooldown` (step 4): this device had too many rejected sessions —
53
+ * {@link HostedSessionView.retryAfter} says when it may try again.
54
+ */
55
+ type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "capture_tampered" | "device_velocity_exceeded" | "device_cooldown";
56
+ /**
57
+ * The profile-v2 policy reasons a session can end on: the two session-level
58
+ * reasons plus the failed check's policy reasons (`document_type_not_accepted`,
59
+ * `nationality_not_allowed`, `underage`, `age_unverifiable`,
60
+ * `document_nni_mismatch`).
61
+ */
62
+ type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "document_nni_mismatch";
63
+ /**
64
+ * How the person proves their identity when the app makes the document
65
+ * optional for registry nationals (profile v2 step 3): type their national
66
+ * number (NNI) and skip the document, or photograph their document.
67
+ */
68
+ type IdentityMethod = "national_number" | "document_photo";
69
+ /**
70
+ * The identity-method choice of a session (`HostedSessionView.methodChoice`).
71
+ * While `available && selected === null` no check can be submitted (409
72
+ * `method_required`): the page asks first and sends the answer with
73
+ * `POST /hosted/method` ({@link HostedClient.selectMethod}).
74
+ */
75
+ interface MethodChoiceView {
76
+ /** The session offers the choice (the app's document mode is `optional`). */
77
+ available: boolean;
78
+ /** The chosen method, or `null` while the person has not chosen. */
79
+ selected: IdentityMethod | null;
80
+ /** The methods to offer, in display order. */
81
+ options: IdentityMethod[];
82
+ }
83
+ /** A document type the backend reads today (kyc-docs-v2 vocabulary). */
84
+ type AcceptedDocumentType = "carte_identite" | "passport";
26
85
  /**
27
86
  * phone_otp DISPLAY-SAFE surface (Task 16). The backend stashes the OTP
28
87
  * service `verifToken` on the check's persisted outputs (the doc_ocr partial
@@ -66,6 +125,67 @@ interface HostedStepView {
66
125
  acceptedSides?: ("recto" | "verso")[];
67
126
  /** phone_otp only: the display-safe OTP send/config surface (never the verifToken). */
68
127
  otp?: HostedOtpView;
128
+ /**
129
+ * The check failed after using all of its attempts — no retry is left.
130
+ * Absent on older APIs (treat absent as `false`).
131
+ */
132
+ attemptsExhausted?: boolean;
133
+ /**
134
+ * population_registry only: the session is not bound to an NNI, but the
135
+ * document step already read a valid one — the page submits the registry
136
+ * check with an EMPTY input (no NNI field) and the backend uses the
137
+ * document's number. Absent on older APIs.
138
+ */
139
+ nniFromDocument?: boolean;
140
+ /**
141
+ * liveness / face_match (profile v2 step 4, decision mode `automatic`): the
142
+ * capture must come from a phone — the liveness band is calibrated on
143
+ * mobile captures only. A desktop page hands the person off to their phone
144
+ * instead of capturing (a desktop submission answers `mobile_required`).
145
+ * Absent on older APIs and in `review` mode.
146
+ */
147
+ requiresMobile?: boolean;
148
+ }
149
+ /** A locale the Sekyro AI-hosted voice clips are recorded in. */
150
+ type HostedVoiceLocale = "ar" | "fr" | "en";
151
+ /**
152
+ * The session's Sekyro AI-hosted voice-guidance clips (the active clip set).
153
+ *
154
+ * `clips[locale]` maps a voice key (`fcv3.*`, the `@sekyro/react` voice-key
155
+ * namespace) to an ABSOLUTE URL on the Sekyro AI assets host
156
+ * (`https://assets.sekyro.ai/voice/<setId>/<locale>/<name>.mp3`; staging:
157
+ * `assets-staging.sekyro.ai`). URLs are immutable per `setId`. A locale or key
158
+ * may be missing — the player falls back to the device voice for it.
159
+ *
160
+ * A page with a Content-Security-Policy must allow the assets origin in
161
+ * `media-src` for the clips to play (see the partner web-SDK guide, CSP note).
162
+ */
163
+ interface HostedVoiceView {
164
+ /** Identifier of the active clip set (part of every clip URL). */
165
+ setId: string;
166
+ /** Per-locale map of voice key (`fcv3.*`) → absolute clip URL. */
167
+ clips: {
168
+ readonly [L in HostedVoiceLocale]?: Readonly<Record<string, string>>;
169
+ };
170
+ }
171
+ /** A branding colour key (each value is `#rrggbb`). */
172
+ type HostedBrandingColorKey = "brand" | "brandFg" | "bg" | "surface" | "fg" | "fgMuted" | "danger" | "success" | "warning";
173
+ /**
174
+ * The org / app branding of a session (`HostedSessionView.branding`): only the
175
+ * fields set in the dashboard, merged per field (app over org). A field the
176
+ * org and app left unset is ABSENT — keep your default for it; the whole
177
+ * object is absent when nothing is set. `logoUrl` is a short-lived signed URL
178
+ * (15 minutes).
179
+ */
180
+ interface HostedBranding {
181
+ /** Signed URL of the logo (PNG or sanitized SVG); absent when none is set. */
182
+ logoUrl?: string;
183
+ /** Colours as `#rrggbb`. */
184
+ colors?: Partial<Record<HostedBrandingColorKey, string>>;
185
+ /** Corner radius step. */
186
+ radius?: "none" | "sm" | "md" | "lg" | "full";
187
+ /** Font choice (system fallbacks when the font is not installed). */
188
+ fontFamily?: "system" | "inter" | "ibm-plex-sans-arabic" | "noto-sans-arabic" | "roboto";
69
189
  }
70
190
  /**
71
191
  * Token-addressed hosted-page bootstrap (`GET /hosted/session`). A separate
@@ -110,6 +230,41 @@ interface HostedSessionView {
110
230
  * valid (additive field, always on the wire from Task 8 onward).
111
231
  */
112
232
  nniBound?: boolean;
233
+ /**
234
+ * The Sekyro AI-hosted voice-guidance clips of this session, or `null` when no
235
+ * clip set is active (the device voice is used). Optional: older APIs omit
236
+ * the field — treat absent like `null`.
237
+ */
238
+ voice?: HostedVoiceView | null;
239
+ /**
240
+ * Why the session ended, when a profile-v2 policy stopped it: a
241
+ * {@link SessionFailureReason}, or the failed check's reason when it is a
242
+ * policy reason (eligibility, or `document_nni_mismatch`). Absent otherwise
243
+ * (and on older APIs).
244
+ */
245
+ failureReason?: PolicyFailureReason;
246
+ /**
247
+ * The document types the person may pick (resolved for issuer `MR`). Absent
248
+ * on older APIs — treat absent as every type (`carte_identite`, `passport`).
249
+ */
250
+ acceptedDocumentTypes?: AcceptedDocumentType[];
251
+ /**
252
+ * The identity-method choice (profile v2 step 3). Absent when the session
253
+ * has no choice (and on older APIs). While `available && selected === null`
254
+ * every check submission answers 409 `method_required`.
255
+ */
256
+ methodChoice?: MethodChoiceView;
257
+ /**
258
+ * ISO-8601 time from which this device may verify again — set with
259
+ * `failureReason: 'device_cooldown'` (profile v2 step 4). Absent otherwise
260
+ * (and on older APIs).
261
+ */
262
+ retryAfter?: string;
263
+ /**
264
+ * The org / app branding (settings spec §5.1). Absent on older APIs — keep
265
+ * the default theme. Map it with `brandingToTheme()` from `@sekyro/react`.
266
+ */
267
+ branding?: HostedBranding;
113
268
  }
114
269
  /** `POST /hosted/consent` result — 201 on first record, 200 `{alreadyRecorded: true}` on replay. */
115
270
  interface RecordConsentResult {
@@ -123,6 +278,8 @@ interface SessionStepView {
123
278
  state: CheckState;
124
279
  reason?: CheckReason;
125
280
  calibratedScore?: number;
281
+ /** The check failed after using all of its attempts. Absent on older APIs. */
282
+ attemptsExhausted?: boolean;
126
283
  }
127
284
  /**
128
285
  * Client-facing session projection returned by
@@ -132,6 +289,8 @@ interface SessionView {
132
289
  id: string;
133
290
  status: SessionStatus;
134
291
  outcome: SessionOutcome | null;
292
+ /** Profile-v2 policy stop reason; absent on ordinary failures and older APIs. */
293
+ failureReason?: PolicyFailureReason;
135
294
  steps: SessionStepView[];
136
295
  /** ISO-8601 timestamp (Date on the server, string on the wire). */
137
296
  expiresAt: string;
@@ -181,7 +340,14 @@ interface AttestationInput {
181
340
  /** The Turnstile site key the token was minted with (selects the verifying secret). */
182
341
  siteKey?: string;
183
342
  }
184
- /** liveness executor input: a promoted `clips/…` key + optional attestation. */
343
+ /**
344
+ * liveness executor input: a promoted `clips/…` key + optional attestation.
345
+ * `faceMatch` (v2 latency §3.2) carries the already-promoted `doc-images/…`
346
+ * keyframe so the backend can run face_match IN THE SAME submission when its
347
+ * bundle flag is on and `face_match` is the next pending step. Backends that
348
+ * do not bundle ignore it (the input bag is an open record) — the SDK then
349
+ * submits `face_match` itself with the same key (see liveness-flow.ts).
350
+ */
185
351
  interface LivenessInput {
186
352
  clipKey: string;
187
353
  attestation?: AttestationInput;
@@ -193,6 +359,10 @@ interface LivenessInput {
193
359
  /** Capture metadata (engine, dimensions, clip length, face-capture timing)
194
360
  * — the backend's allowlisted, non-PII `capture` block (session insights). */
195
361
  capture?: LivenessCaptureInput;
362
+ /** The promoted face_match probe key, for a bundled liveness + face_match run. */
363
+ faceMatch?: {
364
+ imageKey: string;
365
+ };
196
366
  }
197
367
  /** `LivenessInput.capture`: what the SDK's `captured` event measured. All ms are whole, ≥ 0. */
198
368
  interface LivenessCaptureInput {
@@ -213,7 +383,10 @@ interface LivenessCaptureInput {
213
383
  interface PopulationInput {
214
384
  nni?: string;
215
385
  }
216
- /** face_match executor input: a promoted `doc-images/…` key (the source selfie frame). */
386
+ /**
387
+ * face_match executor input: a promoted `doc-images/…` key (the source selfie frame).
388
+ * The same key may already have ridden along as {@link LivenessInput.faceMatch}.
389
+ */
217
390
  interface FaceMatchInput {
218
391
  imageKey: string;
219
392
  }
@@ -320,6 +493,7 @@ interface HostedClientOptions {
320
493
  *
321
494
  * GET /api/v2/hosted/session → {@link getSession}
322
495
  * POST /api/v2/hosted/consent → {@link recordConsent}
496
+ * POST /api/v2/hosted/method → {@link selectMethod}
323
497
  * POST /api/v2/sessions/:id/media → {@link presign}
324
498
  * POST /api/v2/sessions/:id/media/complete → {@link completeMedia}
325
499
  * POST /api/v2/sessions/:id/checks/:checkType → {@link submitCheck}
@@ -358,6 +532,13 @@ declare class HostedClient {
358
532
  * submission answer 409 `consent_required`.
359
533
  */
360
534
  recordConsent(locale: ConsentLocale): Promise<RecordConsentResult>;
535
+ /**
536
+ * Send the person's identity method (profile v2 step 3) when the view offers
537
+ * a choice (`methodChoice.available`). Returns the updated hosted view —
538
+ * continue from it. 409 `method_locked` when the method can no longer
539
+ * change (a check of the chosen method was already submitted).
540
+ */
541
+ selectMethod(method: IdentityMethod): Promise<HostedSessionView>;
361
542
  /**
362
543
  * Presign a Spaces PUT for a new pending object. `contentType` is stripped of
363
544
  * MIME parameters defensively (the allowlist holds bare types; the engine's
@@ -418,4 +599,4 @@ declare class HostedClient {
418
599
  private api;
419
600
  }
420
601
 
421
- export { type AttestationInput as A, type CheckReason as C, type DocReason as D, type FaceMatchReason as F, type HostedOtpView as H, type LivenessReason as L, type MediaCheckType as M, type PhoneOtpReason as P, type RecordConsentResult as R, type SessionOutcome as S, type UploadMedia as U, type CheckState as a, type CheckType as b, type HostedSessionView as c, type HostedStepView as d, type PopulationReason as e, type SessionStatus as f, HostedClient as g, type SessionView as h, type CheckInputByType as i, type CompleteMediaResult as j, type ConsentLocale as k, type DocOcrInput as l, type DocSide as m, type FaceMatchInput as n, type HostedClientOptions as o, type LivenessCaptureInput as p, type LivenessInput as q, type MediaKind as r, type PhoneOtpInput as s, type PopulationInput as t, type PresignRequest as u, type PresignUploadResult as v, type SessionStepView as w, type SubmitCheckBody as x, type SubmitOptions as y, stripMimeParams as z };
602
+ export { type AcceptedDocumentType as A, type MediaCheckType as B, type CheckReason as C, type DecisionReason as D, type MediaKind as E, type FaceMatchReason as F, type PhoneOtpInput as G, type HostedBranding as H, type IdentityMethod as I, type PopulationInput as J, type PresignRequest as K, type LivenessReason as L, type MatchReason as M, type PresignUploadResult as N, type SessionStepView as O, type PhoneOtpReason as P, type SubmitCheckBody as Q, type RecordConsentResult as R, type SessionFailureReason as S, type SubmitOptions as T, type UploadMedia as U, stripMimeParams as V, type CheckState as a, type CheckType as b, type DocReason as c, type HostedBrandingColorKey as d, type HostedOtpView as e, type HostedSessionView as f, type HostedStepView as g, type HostedVoiceLocale as h, type HostedVoiceView as i, type MethodChoiceView as j, type PolicyFailureReason as k, type PopulationReason as l, type SessionOutcome as m, type SessionStatus as n, HostedClient as o, type AttestationInput as p, type SessionView as q, type CheckInputByType as r, type CompleteMediaResult as s, type ConsentLocale as t, type DocOcrInput as u, type DocSide as v, type FaceMatchInput as w, type HostedClientOptions as x, type LivenessCaptureInput as y, type LivenessInput as z };