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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +8 -0
  3. package/dist/camera-trait-45MJTW4K.js +1 -0
  4. package/dist/{capture-session-doc-VXWWQEP4.js → capture-session-doc-QA4DOFRF.js} +1 -1
  5. package/dist/{capture-session-v3-Cs4yV3HJ.d.cts → capture-session-v3-CNL-GX11.d.cts} +1 -1
  6. package/dist/{capture-session-v3-CFSVWYzi.d.ts → capture-session-v3-DaBqN8fO.d.ts} +1 -1
  7. package/dist/chunk-5ZKQHFFW.js +1 -0
  8. package/dist/{chunk-ZPXL26BF.js → chunk-FGOVIGGL.js} +1 -1
  9. package/dist/{chunk-RNJA5GDF.js → chunk-IG466TOP.js} +1 -1
  10. package/dist/{chunk-4GJXUVZK.js → chunk-KHR4U2SZ.js} +1 -1
  11. package/dist/chunk-KZBBB5B2.js +1 -0
  12. package/dist/chunk-NJML6FMD.js +1 -0
  13. package/dist/chunk-TQB3URP2.js +1 -0
  14. package/dist/{chunk-ZO6IHP2I.js → chunk-U6S7SCBY.js} +1 -1
  15. package/dist/{chunk-6K4D3U6Q.js → chunk-W2WD7PR2.js} +1 -1
  16. package/dist/chunk-XCKE2MJL.js +1 -0
  17. package/dist/chunk-ZLWH4RBO.js +1 -0
  18. package/dist/client/index.cjs +1 -1
  19. package/dist/client/index.d.cts +6 -71
  20. package/dist/client/index.d.ts +6 -71
  21. package/dist/client/index.js +1 -1
  22. package/dist/core/index.cjs +1 -1
  23. package/dist/core/index.d.cts +3 -3
  24. package/dist/core/index.d.ts +3 -3
  25. package/dist/core/index.js +1 -1
  26. package/dist/{create-document-capture-FVSQPUF6.js → create-document-capture-GJXBQMTC.js} +1 -1
  27. package/dist/{create-portrait-capture-INDCF65X.js → create-portrait-capture-MOS2D7CL.js} +1 -1
  28. package/dist/{create-verification-1BrMZqPJ.d.cts → create-verification-BBOUYpga.d.cts} +113 -22
  29. package/dist/{create-verification-CuoYJ3kj.d.ts → create-verification-COpe2hxf.d.ts} +113 -22
  30. package/dist/{icao-gate-BSbyqLUh.d.ts → icao-gate-CEGvJR3q.d.ts} +19 -9
  31. package/dist/{icao-gate-D-wePfoV.d.cts → icao-gate-l40OU6x1.d.cts} +19 -9
  32. package/dist/icao-policy-BgI1Y870.d.ts +71 -0
  33. package/dist/icao-policy-C7fIdRzo.d.cts +71 -0
  34. package/dist/index.cjs +1 -1
  35. package/dist/index.d.cts +7 -7
  36. package/dist/index.d.ts +7 -7
  37. package/dist/index.js +1 -1
  38. package/dist/internal/index.cjs +1 -1
  39. package/dist/internal/index.d.cts +6 -6
  40. package/dist/internal/index.d.ts +6 -6
  41. package/dist/internal/index.js +1 -1
  42. package/dist/plan-runner-35655N4Z.js +1 -0
  43. package/dist/print-AYSCRSZB.js +1 -0
  44. package/dist/{types-DPl0hsmI.d.cts → types-Dpfg2cO8.d.cts} +149 -11
  45. package/dist/{types-DPl0hsmI.d.ts → types-Dpfg2cO8.d.ts} +149 -11
  46. package/dist/upload-file-UYXOHCRG.js +1 -0
  47. package/package.json +3 -2
  48. package/sbom.cdx.json +46 -7
  49. package/dist/chunk-5Y3UST3W.js +0 -1
  50. package/dist/chunk-64V55KD7.js +0 -1
  51. package/dist/chunk-JUEOHNVW.js +0 -1
  52. package/dist/chunk-L45YTRJJ.js +0 -1
  53. package/dist/chunk-PLH6ZR6J.js +0 -1
  54. package/dist/plan-runner-WEUIMCYU.js +0 -1
@@ -1,4 +1,4 @@
1
- import { H as HostedSessionView, C as ConsentLocale, a as HostedConsentView, b as CameraUnavailableCause, c as CaptureIssueReport, I as IdentityConfirmDecision, M as MediaKind, P as PresignUploadResult, d as CaptureContext, e as CompleteMediaResult, f as CheckType, g as CheckInputByType, h as IcaoCriterion, B as BackgroundUniformity, R as ResolvedIcaoTuning } from './types-DPl0hsmI.js';
1
+ import { R as HostedSessionView, j as ConsentLocale, v as HostedConsentView, aI as CameraUnavailableCause, aJ as CaptureIssueReport, X as IdentityConfirmDecision, a3 as MediaKind, au as PresignUploadResult, C as CaptureContext, i as CompleteMediaResult, h as CheckType, e as CheckInputByType, V as IcaoCriterion, aY as BackgroundUniformity, aV as ResolvedIcaoTuning } from './types-Dpfg2cO8.js';
2
2
 
3
3
  interface Point {
4
4
  x: number;
@@ -132,6 +132,11 @@ interface HostedClientOptions {
132
132
  attempts?: number;
133
133
  delayMs?: number;
134
134
  };
135
+ /**
136
+ * Injection seam (tests): the source of the busy-retry jitter, returning a value in [0, 1).
137
+ * Defaults to `Math.random`.
138
+ */
139
+ random?: () => number;
135
140
  }
136
141
  /**
137
142
  * Hand-authored typed client for the five session-token endpoints:
@@ -158,8 +163,8 @@ interface HostedClientOptions {
158
163
  * `:id` route is called first.
159
164
  *
160
165
  * Two automatic retries only: bounded short-delay retry on 409
161
- * `idempotency_in_progress`, and ONE retry after `Retry-After` (capped at 3 s)
162
- * on a 503 `server_busy` / `request_timeout` for the calls that are safe to
166
+ * `idempotency_in_progress`, and ONE retry after `Retry-After` (capped at 20 s,
167
+ * ±25 % jitter) on a 503 `server_busy` / `request_timeout` for the calls that are safe to
163
168
  * repeat: the reads (`getSession`, `identityPortrait`), the naturally
164
169
  * idempotent writes (`recordConsent`, `choose`) and `submitCheck` with an
165
170
  * idempotency key. Everything else — including 429 with its parsed
@@ -177,12 +182,13 @@ declare class HostedClient {
177
182
  private readonly requestTimeoutMs;
178
183
  private readonly retryAttempts;
179
184
  private readonly retryDelayMs;
185
+ private readonly random;
180
186
  private sessionId;
181
187
  private bootstrap;
182
188
  /** D8: prefetched capture nonces (`armCapture`), each with its local expiry. */
183
189
  private captureNonces;
184
190
  private captureFetch;
185
- /** Capture issues already reported (see reportCaptureIssue). */
191
+ /** Capture issues already reported, with their send (see reportCaptureIssue): a repeat awaits the first. */
186
192
  private readonly reportedIssues;
187
193
  constructor(opts: HostedClientOptions);
188
194
  /** Token-addressed bootstrap — the hosted page's first call. Caches the sessionId. */
@@ -203,7 +209,8 @@ declare class HostedClient {
203
209
  /**
204
210
  * 2026-11-04: record a capture failure the page showed (`POST /hosted/capture-issue`, 204) so it can be diagnosed
205
211
  * later. Fire-and-forget: never rejects, and every failure is swallowed. At most one report per distinct
206
- * (check, attempt, kind, name, phase); a repeat resolves without a call. `name` is re-sanitised (letters only, at most
212
+ * (check, attempt, kind, name, phase); a repeat makes no call and resolves when the first send settles (a failed send
213
+ * is forgotten, so a later repeat sends again). `name` is re-sanitised (letters only, at most
207
214
  * 40 characters) and `engineKind` kept only when it is a lower-case code of at most 32 characters.
208
215
  */
209
216
  reportCaptureIssue(issue: CaptureIssueReport): Promise<void>;
@@ -234,7 +241,9 @@ declare class HostedClient {
234
241
  * `clipMimeType` carries codec params) — PUT with the SAME bare type, or the
235
242
  * signed-header check rejects the upload.
236
243
  */
237
- presign(kind: MediaKind, contentType: string, contentLength: number): Promise<PresignUploadResult>;
244
+ presign(kind: MediaKind, contentType: string, contentLength: number, options?: {
245
+ source?: "upload";
246
+ }): Promise<PresignUploadResult>;
238
247
  /**
239
248
  * D8: prefetch live-camera capture nonces when a camera capture STARTS, so the
240
249
  * presigns that follow (`presignCapture`) need no extra round trip. Never
@@ -304,8 +313,9 @@ declare class HostedClient {
304
313
  * unparseable 2xx body → `unknown_error` — the page never sees a raw
305
314
  * TypeError/DOMException. Automatic retries: 409 `idempotency_in_progress`
306
315
  * (bounded, short delay), and ONE retry of a 503 `server_busy` /
307
- * `request_timeout` after its `Retry-After` (capped at 3 s) when the call is
308
- * safe to repeat: every GET, and a POST that sets `busyRetry`.
316
+ * `request_timeout` after its `Retry-After` (default 2 s, capped at 20 s, ±25 %
317
+ * jitter) when the call is safe to repeat: every GET, and a POST that sets
318
+ * `busyRetry`. The wait runs between requests, outside each request's timeout.
309
319
  */
310
320
  private api;
311
321
  }
@@ -521,4 +531,4 @@ interface IcaoGateOptions {
521
531
  }
522
532
  declare function createIcaoGate(t: ResolvedIcaoTuning, options?: IcaoGateOptions): IcaoGate;
523
533
 
524
- export { lumaPlane as A, type BackgroundStats as B, CLIPPED_LUMA as C, percentile as D, portraitCropRegion as E, type FaceGeometry as F, poseFromMatrix as G, type HeadPose as H, type IcaoCoachKey as I, regionStats as J, scoreFrame as K, type LumaPlane as L, windowOverflow as M, HostedClient as N, type HostedClientOptions as O, type Point as P, type MediaCheckType as Q, type RegionStats as R, SEKYRO_SDK_HEADER as S, type SubmitOptions as T, type UploadMedia as U, stripMimeParams as V, type IcaoCriterionState as a, type IcaoGateCriterion as b, type IcaoGateSummary as c, type IcaoGateUpdate as d, type Box as e, type FaceLighting as f, ICAO_CANVAS as g, ICAO_GATE_CRITERIA as h, ICAO_SHARP_REF as i, type IcaoFrameObservation as j, type IcaoGate as k, type IcaoGateOptions as l, type IcaoJudgedCriterion as m, type IcaoMeasures as n, type IcaoPixelStats as o, backgroundStats as p, createIcaoGate as q, eyeLineRoll as r, eyeOpenness as s, eyeSpecular as t, faceGeometry as u, faceLighting as v, faceSharpness as w, icaoPixelStats as x, icaoWindow as y, judgeIcao as z };
534
+ export { faceSharpness as A, type BackgroundStats as B, CLIPPED_LUMA as C, icaoPixelStats as D, icaoWindow as E, type FaceGeometry as F, judgeIcao as G, HostedClient as H, type IcaoCoachKey as I, lumaPlane as J, percentile as K, type LumaPlane as L, type MediaCheckType as M, portraitCropRegion as N, poseFromMatrix as O, type Point as P, regionStats as Q, type RegionStats as R, SEKYRO_SDK_HEADER as S, scoreFrame as T, type UploadMedia as U, windowOverflow as V, type HostedClientOptions as a, type SubmitOptions as b, type HeadPose as c, type IcaoCriterionState as d, type IcaoGateCriterion as e, type IcaoGateSummary as f, type IcaoGateUpdate as g, type Box as h, type FaceLighting as i, ICAO_CANVAS as j, ICAO_GATE_CRITERIA as k, ICAO_SHARP_REF as l, type IcaoFrameObservation as m, type IcaoGate as n, type IcaoGateOptions as o, type IcaoJudgedCriterion as p, type IcaoMeasures as q, type IcaoPixelStats as r, stripMimeParams as s, backgroundStats as t, createIcaoGate as u, eyeLineRoll as v, eyeOpenness as w, eyeSpecular as x, faceGeometry as y, faceLighting as z };
@@ -1,4 +1,4 @@
1
- import { H as HostedSessionView, C as ConsentLocale, a as HostedConsentView, b as CameraUnavailableCause, c as CaptureIssueReport, I as IdentityConfirmDecision, M as MediaKind, P as PresignUploadResult, d as CaptureContext, e as CompleteMediaResult, f as CheckType, g as CheckInputByType, h as IcaoCriterion, B as BackgroundUniformity, R as ResolvedIcaoTuning } from './types-DPl0hsmI.cjs';
1
+ import { R as HostedSessionView, j as ConsentLocale, v as HostedConsentView, aI as CameraUnavailableCause, aJ as CaptureIssueReport, X as IdentityConfirmDecision, a3 as MediaKind, au as PresignUploadResult, C as CaptureContext, i as CompleteMediaResult, h as CheckType, e as CheckInputByType, V as IcaoCriterion, aY as BackgroundUniformity, aV as ResolvedIcaoTuning } from './types-Dpfg2cO8.cjs';
2
2
 
3
3
  interface Point {
4
4
  x: number;
@@ -132,6 +132,11 @@ interface HostedClientOptions {
132
132
  attempts?: number;
133
133
  delayMs?: number;
134
134
  };
135
+ /**
136
+ * Injection seam (tests): the source of the busy-retry jitter, returning a value in [0, 1).
137
+ * Defaults to `Math.random`.
138
+ */
139
+ random?: () => number;
135
140
  }
136
141
  /**
137
142
  * Hand-authored typed client for the five session-token endpoints:
@@ -158,8 +163,8 @@ interface HostedClientOptions {
158
163
  * `:id` route is called first.
159
164
  *
160
165
  * Two automatic retries only: bounded short-delay retry on 409
161
- * `idempotency_in_progress`, and ONE retry after `Retry-After` (capped at 3 s)
162
- * on a 503 `server_busy` / `request_timeout` for the calls that are safe to
166
+ * `idempotency_in_progress`, and ONE retry after `Retry-After` (capped at 20 s,
167
+ * ±25 % jitter) on a 503 `server_busy` / `request_timeout` for the calls that are safe to
163
168
  * repeat: the reads (`getSession`, `identityPortrait`), the naturally
164
169
  * idempotent writes (`recordConsent`, `choose`) and `submitCheck` with an
165
170
  * idempotency key. Everything else — including 429 with its parsed
@@ -177,12 +182,13 @@ declare class HostedClient {
177
182
  private readonly requestTimeoutMs;
178
183
  private readonly retryAttempts;
179
184
  private readonly retryDelayMs;
185
+ private readonly random;
180
186
  private sessionId;
181
187
  private bootstrap;
182
188
  /** D8: prefetched capture nonces (`armCapture`), each with its local expiry. */
183
189
  private captureNonces;
184
190
  private captureFetch;
185
- /** Capture issues already reported (see reportCaptureIssue). */
191
+ /** Capture issues already reported, with their send (see reportCaptureIssue): a repeat awaits the first. */
186
192
  private readonly reportedIssues;
187
193
  constructor(opts: HostedClientOptions);
188
194
  /** Token-addressed bootstrap — the hosted page's first call. Caches the sessionId. */
@@ -203,7 +209,8 @@ declare class HostedClient {
203
209
  /**
204
210
  * 2026-11-04: record a capture failure the page showed (`POST /hosted/capture-issue`, 204) so it can be diagnosed
205
211
  * later. Fire-and-forget: never rejects, and every failure is swallowed. At most one report per distinct
206
- * (check, attempt, kind, name, phase); a repeat resolves without a call. `name` is re-sanitised (letters only, at most
212
+ * (check, attempt, kind, name, phase); a repeat makes no call and resolves when the first send settles (a failed send
213
+ * is forgotten, so a later repeat sends again). `name` is re-sanitised (letters only, at most
207
214
  * 40 characters) and `engineKind` kept only when it is a lower-case code of at most 32 characters.
208
215
  */
209
216
  reportCaptureIssue(issue: CaptureIssueReport): Promise<void>;
@@ -234,7 +241,9 @@ declare class HostedClient {
234
241
  * `clipMimeType` carries codec params) — PUT with the SAME bare type, or the
235
242
  * signed-header check rejects the upload.
236
243
  */
237
- presign(kind: MediaKind, contentType: string, contentLength: number): Promise<PresignUploadResult>;
244
+ presign(kind: MediaKind, contentType: string, contentLength: number, options?: {
245
+ source?: "upload";
246
+ }): Promise<PresignUploadResult>;
238
247
  /**
239
248
  * D8: prefetch live-camera capture nonces when a camera capture STARTS, so the
240
249
  * presigns that follow (`presignCapture`) need no extra round trip. Never
@@ -304,8 +313,9 @@ declare class HostedClient {
304
313
  * unparseable 2xx body → `unknown_error` — the page never sees a raw
305
314
  * TypeError/DOMException. Automatic retries: 409 `idempotency_in_progress`
306
315
  * (bounded, short delay), and ONE retry of a 503 `server_busy` /
307
- * `request_timeout` after its `Retry-After` (capped at 3 s) when the call is
308
- * safe to repeat: every GET, and a POST that sets `busyRetry`.
316
+ * `request_timeout` after its `Retry-After` (default 2 s, capped at 20 s, ±25 %
317
+ * jitter) when the call is safe to repeat: every GET, and a POST that sets
318
+ * `busyRetry`. The wait runs between requests, outside each request's timeout.
309
319
  */
310
320
  private api;
311
321
  }
@@ -521,4 +531,4 @@ interface IcaoGateOptions {
521
531
  }
522
532
  declare function createIcaoGate(t: ResolvedIcaoTuning, options?: IcaoGateOptions): IcaoGate;
523
533
 
524
- export { lumaPlane as A, type BackgroundStats as B, CLIPPED_LUMA as C, percentile as D, portraitCropRegion as E, type FaceGeometry as F, poseFromMatrix as G, type HeadPose as H, type IcaoCoachKey as I, regionStats as J, scoreFrame as K, type LumaPlane as L, windowOverflow as M, HostedClient as N, type HostedClientOptions as O, type Point as P, type MediaCheckType as Q, type RegionStats as R, SEKYRO_SDK_HEADER as S, type SubmitOptions as T, type UploadMedia as U, stripMimeParams as V, type IcaoCriterionState as a, type IcaoGateCriterion as b, type IcaoGateSummary as c, type IcaoGateUpdate as d, type Box as e, type FaceLighting as f, ICAO_CANVAS as g, ICAO_GATE_CRITERIA as h, ICAO_SHARP_REF as i, type IcaoFrameObservation as j, type IcaoGate as k, type IcaoGateOptions as l, type IcaoJudgedCriterion as m, type IcaoMeasures as n, type IcaoPixelStats as o, backgroundStats as p, createIcaoGate as q, eyeLineRoll as r, eyeOpenness as s, eyeSpecular as t, faceGeometry as u, faceLighting as v, faceSharpness as w, icaoPixelStats as x, icaoWindow as y, judgeIcao as z };
534
+ export { faceSharpness as A, type BackgroundStats as B, CLIPPED_LUMA as C, icaoPixelStats as D, icaoWindow as E, type FaceGeometry as F, judgeIcao as G, HostedClient as H, type IcaoCoachKey as I, lumaPlane as J, percentile as K, type LumaPlane as L, type MediaCheckType as M, portraitCropRegion as N, poseFromMatrix as O, type Point as P, regionStats as Q, type RegionStats as R, SEKYRO_SDK_HEADER as S, scoreFrame as T, type UploadMedia as U, windowOverflow as V, type HostedClientOptions as a, type SubmitOptions as b, type HeadPose as c, type IcaoCriterionState as d, type IcaoGateCriterion as e, type IcaoGateSummary as f, type IcaoGateUpdate as g, type Box as h, type FaceLighting as i, ICAO_CANVAS as j, ICAO_GATE_CRITERIA as k, ICAO_SHARP_REF as l, type IcaoFrameObservation as m, type IcaoGate as n, type IcaoGateOptions as o, type IcaoJudgedCriterion as p, type IcaoMeasures as q, type IcaoPixelStats as r, stripMimeParams as s, backgroundStats as t, createIcaoGate as u, eyeLineRoll as v, eyeOpenness as w, eyeSpecular as x, faceGeometry as y, faceLighting as z };
@@ -0,0 +1,71 @@
1
+ import { f as IcaoGateSummary } from './icao-gate-CEGvJR3q.js';
2
+ import { R as HostedSessionView, I as HostedIcaoPolicy, aq as PortraitIcaoInput } from './types-Dpfg2cO8.js';
3
+
4
+ /**
5
+ * Every error code the hosted page can receive from the session-token surface.
6
+ * A closed string-literal union — switch over {@link KnownCode} with a `never`
7
+ * default arm for compile-checked exhaustiveness.
8
+ */
9
+ declare const KNOWN_CODES: readonly ["session_token_invalid", "session_token_required", "session_token_session_mismatch", "session_not_found", "rate_limit_exceeded", "consent_required", "session_not_active", "check_not_found", "check_already_finalized", "check_out_of_order", "check_type_unsupported", "force_outcome_forbidden", "attestation_invalid", "platform_unregistered", "app_attest_invalid", "too_many_challenges", "inference_unavailable", "mobile_required", "nni_locked", "document_nni_mismatch", "media_content_type_not_allowed", "media_too_large", "media_key_invalid", "media_key_forbidden", "media_not_found", "media_unreadable", "media_session_invalid", "idempotency_key_collision", "idempotency_in_progress", "idempotency_key_required", "validation_error", "internal_error", "unknown_error", "upload_failed", "network_error", "timeout", "nfc_outcome_not_accepted", "identity_confirm_required", "identity_confirm_locked", "choice_not_found", "choice_locked", "choice_option_unavailable", "step_not_on_path", "check_not_active", "sekyro_app_not_allowed", "sekyro_app_unverified", "id_number_locked", "document_id_number_mismatch"];
10
+ /** Closed union of {@link KNOWN_CODES} — exhaustively switchable. */
11
+ type KnownCode = (typeof KNOWN_CODES)[number];
12
+ /** Narrow an arbitrary wire code to the known union (unknown codes stay `string`). */
13
+ declare function isKnownCode(code: string): code is KnownCode;
14
+ /** One machine-readable problem of an error's `details` (Sekyro flows spec §9.4). */
15
+ interface HostedErrorIssue {
16
+ code: string;
17
+ message: string;
18
+ /** The request field (`option`, `nodeId`, …). */
19
+ path?: string;
20
+ /** A node of the flow. */
21
+ nodeId?: string;
22
+ service?: string;
23
+ field?: string;
24
+ }
25
+ /** `details` of a flow error envelope (`choice_*`, `step_not_on_path`, …): the issues, and more per code. */
26
+ interface HostedErrorDetails {
27
+ issues: HostedErrorIssue[];
28
+ /** `override_widens_flow`: the widened fields. */
29
+ fields?: string[];
30
+ [key: string]: unknown;
31
+ }
32
+ /**
33
+ * Typed transport error: EVERY failure surfaces as one of these — non-2xx
34
+ * responses, rejected fetches, timeouts, and unparseable bodies alike. The
35
+ * hosted page never sees a raw TypeError/DOMException from the client.
36
+ *
37
+ * - `code` — the public envelope's `code`, or a client-synthesized fallback
38
+ * ('unknown_error' / 'upload_failed' / 'network_error' / 'timeout'). Typed
39
+ * `string` because the wire may grow codes; narrow with {@link isKnownCode}
40
+ * before an exhaustive switch.
41
+ * - `status` — the HTTP status, or 0 when no response arrived at all
42
+ * ('network_error' / 'timeout').
43
+ * - `retryAfterSeconds` — parsed from the `Retry-After` header when present
44
+ * (rate-limit 429s always set it).
45
+ * - `details` — the envelope's machine-readable `details` when present (flow
46
+ * errors: `issues[]`).
47
+ */
48
+ declare class HostedApiError extends Error {
49
+ readonly status: number;
50
+ readonly code: string;
51
+ readonly retryAfterSeconds?: number;
52
+ readonly details?: HostedErrorDetails;
53
+ constructor(args: {
54
+ status: number;
55
+ code: string;
56
+ message: string;
57
+ retryAfterSeconds?: number;
58
+ details?: HostedErrorDetails | undefined;
59
+ });
60
+ }
61
+
62
+ /** The session's ICAO policy and profile, or `null` when the selfie is not ICAO-checked. */
63
+ declare function icaoPolicyOf(view: Pick<HostedSessionView, "portrait"> | null | undefined): HostedIcaoPolicy | null;
64
+ /**
65
+ * The `gate` block of a `portrait_icao` body from the gate's summary: the eye
66
+ * baseline, the device verdict under the server's criterion names, and the
67
+ * background-uniformity numbers (telemetry).
68
+ */
69
+ declare function portraitIcaoGate(summary: IcaoGateSummary): NonNullable<PortraitIcaoInput["gate"]>;
70
+
71
+ export { HostedApiError as H, KNOWN_CODES as K, type HostedErrorDetails as a, type HostedErrorIssue as b, type KnownCode as c, isKnownCode as d, icaoPolicyOf as i, portraitIcaoGate as p };
@@ -0,0 +1,71 @@
1
+ import { f as IcaoGateSummary } from './icao-gate-l40OU6x1.cjs';
2
+ import { R as HostedSessionView, I as HostedIcaoPolicy, aq as PortraitIcaoInput } from './types-Dpfg2cO8.cjs';
3
+
4
+ /**
5
+ * Every error code the hosted page can receive from the session-token surface.
6
+ * A closed string-literal union — switch over {@link KnownCode} with a `never`
7
+ * default arm for compile-checked exhaustiveness.
8
+ */
9
+ declare const KNOWN_CODES: readonly ["session_token_invalid", "session_token_required", "session_token_session_mismatch", "session_not_found", "rate_limit_exceeded", "consent_required", "session_not_active", "check_not_found", "check_already_finalized", "check_out_of_order", "check_type_unsupported", "force_outcome_forbidden", "attestation_invalid", "platform_unregistered", "app_attest_invalid", "too_many_challenges", "inference_unavailable", "mobile_required", "nni_locked", "document_nni_mismatch", "media_content_type_not_allowed", "media_too_large", "media_key_invalid", "media_key_forbidden", "media_not_found", "media_unreadable", "media_session_invalid", "idempotency_key_collision", "idempotency_in_progress", "idempotency_key_required", "validation_error", "internal_error", "unknown_error", "upload_failed", "network_error", "timeout", "nfc_outcome_not_accepted", "identity_confirm_required", "identity_confirm_locked", "choice_not_found", "choice_locked", "choice_option_unavailable", "step_not_on_path", "check_not_active", "sekyro_app_not_allowed", "sekyro_app_unverified", "id_number_locked", "document_id_number_mismatch"];
10
+ /** Closed union of {@link KNOWN_CODES} — exhaustively switchable. */
11
+ type KnownCode = (typeof KNOWN_CODES)[number];
12
+ /** Narrow an arbitrary wire code to the known union (unknown codes stay `string`). */
13
+ declare function isKnownCode(code: string): code is KnownCode;
14
+ /** One machine-readable problem of an error's `details` (Sekyro flows spec §9.4). */
15
+ interface HostedErrorIssue {
16
+ code: string;
17
+ message: string;
18
+ /** The request field (`option`, `nodeId`, …). */
19
+ path?: string;
20
+ /** A node of the flow. */
21
+ nodeId?: string;
22
+ service?: string;
23
+ field?: string;
24
+ }
25
+ /** `details` of a flow error envelope (`choice_*`, `step_not_on_path`, …): the issues, and more per code. */
26
+ interface HostedErrorDetails {
27
+ issues: HostedErrorIssue[];
28
+ /** `override_widens_flow`: the widened fields. */
29
+ fields?: string[];
30
+ [key: string]: unknown;
31
+ }
32
+ /**
33
+ * Typed transport error: EVERY failure surfaces as one of these — non-2xx
34
+ * responses, rejected fetches, timeouts, and unparseable bodies alike. The
35
+ * hosted page never sees a raw TypeError/DOMException from the client.
36
+ *
37
+ * - `code` — the public envelope's `code`, or a client-synthesized fallback
38
+ * ('unknown_error' / 'upload_failed' / 'network_error' / 'timeout'). Typed
39
+ * `string` because the wire may grow codes; narrow with {@link isKnownCode}
40
+ * before an exhaustive switch.
41
+ * - `status` — the HTTP status, or 0 when no response arrived at all
42
+ * ('network_error' / 'timeout').
43
+ * - `retryAfterSeconds` — parsed from the `Retry-After` header when present
44
+ * (rate-limit 429s always set it).
45
+ * - `details` — the envelope's machine-readable `details` when present (flow
46
+ * errors: `issues[]`).
47
+ */
48
+ declare class HostedApiError extends Error {
49
+ readonly status: number;
50
+ readonly code: string;
51
+ readonly retryAfterSeconds?: number;
52
+ readonly details?: HostedErrorDetails;
53
+ constructor(args: {
54
+ status: number;
55
+ code: string;
56
+ message: string;
57
+ retryAfterSeconds?: number;
58
+ details?: HostedErrorDetails | undefined;
59
+ });
60
+ }
61
+
62
+ /** The session's ICAO policy and profile, or `null` when the selfie is not ICAO-checked. */
63
+ declare function icaoPolicyOf(view: Pick<HostedSessionView, "portrait"> | null | undefined): HostedIcaoPolicy | null;
64
+ /**
65
+ * The `gate` block of a `portrait_icao` body from the gate's summary: the eye
66
+ * baseline, the device verdict under the server's criterion names, and the
67
+ * background-uniformity numbers (telemetry).
68
+ */
69
+ declare function portraitIcaoGate(summary: IcaoGateSummary): NonNullable<PortraitIcaoInput["gate"]>;
70
+
71
+ export { HostedApiError as H, KNOWN_CODES as K, type HostedErrorDetails as a, type HostedErrorIssue as b, type KnownCode as c, isKnownCode as d, icaoPolicyOf as i, portraitIcaoGate as p };