@sekyro/web 0.0.0-stage → 0.1.0-rc.2

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 (68) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +20 -0
  3. package/README.md +92 -2
  4. package/dist/capture-constraints-BujkZcfb.d.cts +21 -0
  5. package/dist/capture-constraints-BujkZcfb.d.ts +21 -0
  6. package/dist/capture-session-v3-BJ8ciaWl.d.ts +457 -0
  7. package/dist/capture-session-v3-CAoWM8iT.d.cts +457 -0
  8. package/dist/chunk-BPYVZUJA.js +852 -0
  9. package/dist/chunk-BPYVZUJA.js.map +1 -0
  10. package/dist/chunk-LOTAJDRE.js +1094 -0
  11. package/dist/chunk-LOTAJDRE.js.map +1 -0
  12. package/dist/chunk-MWNFSNMP.js +52 -0
  13. package/dist/chunk-MWNFSNMP.js.map +1 -0
  14. package/dist/chunk-NILNKLK6.js +50 -0
  15. package/dist/chunk-NILNKLK6.js.map +1 -0
  16. package/dist/chunk-NWF46H7K.js +359 -0
  17. package/dist/chunk-NWF46H7K.js.map +1 -0
  18. package/dist/chunk-WY6U7AIK.js +193 -0
  19. package/dist/chunk-WY6U7AIK.js.map +1 -0
  20. package/dist/chunk-YVFF4Q4G.js +327 -0
  21. package/dist/chunk-YVFF4Q4G.js.map +1 -0
  22. package/dist/client/index.cjs +357 -0
  23. package/dist/client/index.cjs.map +1 -0
  24. package/dist/client/index.d.cts +39 -0
  25. package/dist/client/index.d.ts +39 -0
  26. package/dist/client/index.js +15 -0
  27. package/dist/client/index.js.map +1 -0
  28. package/dist/core/index.cjs +1605 -0
  29. package/dist/core/index.cjs.map +1 -0
  30. package/dist/core/index.d.cts +87 -0
  31. package/dist/core/index.d.ts +87 -0
  32. package/dist/core/index.js +139 -0
  33. package/dist/core/index.js.map +1 -0
  34. package/dist/core/v3/detect-worker.cjs +392 -0
  35. package/dist/core/v3/detect-worker.cjs.map +1 -0
  36. package/dist/core/v3/detect-worker.d.cts +1 -0
  37. package/dist/core/v3/detect-worker.d.ts +1 -0
  38. package/dist/core/v3/detect-worker.js +13 -0
  39. package/dist/core/v3/detect-worker.js.map +1 -0
  40. package/dist/create-verification-CjLnJ0w6.d.ts +348 -0
  41. package/dist/create-verification-EnZ13uY4.d.cts +348 -0
  42. package/dist/detect-worker-CKXHlXx9.d.cts +105 -0
  43. package/dist/detect-worker-CKXHlXx9.d.ts +105 -0
  44. package/dist/detector-scanic-4C6IEW2K.js +787 -0
  45. package/dist/detector-scanic-4C6IEW2K.js.map +1 -0
  46. package/dist/hosted-client-BpvBqu9f.d.cts +408 -0
  47. package/dist/hosted-client-BpvBqu9f.d.ts +408 -0
  48. package/dist/index.cjs +2636 -0
  49. package/dist/index.cjs.map +1 -0
  50. package/dist/index.d.cts +6 -0
  51. package/dist/index.d.ts +6 -0
  52. package/dist/index.js +28 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/internal/index.cjs +4166 -0
  55. package/dist/internal/index.cjs.map +1 -0
  56. package/dist/internal/index.d.cts +431 -0
  57. package/dist/internal/index.d.ts +431 -0
  58. package/dist/internal/index.js +647 -0
  59. package/dist/internal/index.js.map +1 -0
  60. package/dist/popup/index.cjs +76 -0
  61. package/dist/popup/index.cjs.map +1 -0
  62. package/dist/popup/index.d.cts +66 -0
  63. package/dist/popup/index.d.ts +66 -0
  64. package/dist/popup/index.js +11 -0
  65. package/dist/popup/index.js.map +1 -0
  66. package/dist/scanic-ml-stub-S2OZ6HEF.js +10 -0
  67. package/dist/scanic-ml-stub-S2OZ6HEF.js.map +1 -0
  68. package/package.json +118 -4
@@ -0,0 +1,408 @@
1
+ /** Session lifecycle status (spec §4 two-field status/outcome model). */
2
+ type SessionStatus = "created" | "in_progress" | "review_pending" | "completed" | "expired" | "failed";
3
+ /** Terminal verdict, orthogonal to `status`; `null` until terminal/review. */
4
+ type SessionOutcome = "approved" | "review" | "rejected";
5
+ /** Per-check seven-state machine (spec §4.3). */
6
+ type CheckState = "pending" | "input_required" | "processing" | "passed" | "failed" | "review" | "skipped";
7
+ /** The frozen check-type vocabulary (CHECK_TYPES). `phone_otp` joined in Task 13. */
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";
13
+ /**
14
+ * phone_otp reasons (Task 13). All transient — the caller fixes them by
15
+ * re-entering / resending: `otp_mismatch` (wrong or missing code),
16
+ * `otp_expired` (code lapsed or no active send), `otp_send_failed` (the OTP
17
+ * service was unreachable / a send returned no token).
18
+ */
19
+ type PhoneOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed";
20
+ /**
21
+ * Any frozen reason code. The backend declares the field `string`, but the
22
+ * taxonomy is frozen (do-not-drift) — the union IS the contract. NB: liveness
23
+ * and face_match both carry `review_band`.
24
+ */
25
+ type CheckReason = LivenessReason | PopulationReason | FaceMatchReason | DocReason | PhoneOtpReason;
26
+ /**
27
+ * phone_otp DISPLAY-SAFE surface (Task 16). The backend stashes the OTP
28
+ * service `verifToken` on the check's persisted outputs (the doc_ocr partial
29
+ * mechanism), but that token is NEVER projected here — only the fields the
30
+ * hosted OTP step renders. `numberSource` (org-authored config) drives the
31
+ * send-phase UI (prefilled display vs entry); the rest appear ONLY once a send
32
+ * has parked the check (`sentToMasked` present ⇒ verify phase).
33
+ */
34
+ interface HostedOtpView {
35
+ /**
36
+ * Per-step `config.numberSource` — drives the send-phase UI (prefilled
37
+ * display vs entry). Narrowed to the frontend contract; the backend field is
38
+ * `string` (dynamic config) but the projection only ever emits these three.
39
+ */
40
+ numberSource?: "prefilled" | "user_entered" | "prefilled_or_entered";
41
+ /** Masked target the last send went to (e.g. `+222 ** ** 34 56`); absent pre-send. */
42
+ sentToMasked?: string;
43
+ /** Delivery channel of the last send. */
44
+ channel?: "sms" | "whatsapp";
45
+ /** ISO-8601 OTP expiry from the last send — drives the verify-phase countdown. */
46
+ expiresAt?: string;
47
+ }
48
+ /**
49
+ * Per-check projection in a {@link HostedSessionView} — the spec'd hosted step
50
+ * shape. NEVER carries `calibratedScore` or the raw check `outputs`; the only
51
+ * output-derived data is the phone_otp `HostedOtpView` display subset
52
+ * (masked number/channel/expiry — never the verifToken).
53
+ */
54
+ interface HostedStepView {
55
+ checkType: CheckType;
56
+ state: CheckState;
57
+ /** Frozen-taxonomy reason code explaining a `failed`/`review` state. */
58
+ reason?: CheckReason;
59
+ /**
60
+ * Submissions the page may still make for this check (`max(0, cap - attempts)`).
61
+ * Meaningful only while the check is executable — a finalized check may still
62
+ * report more than 0, but re-submitting it 409s regardless.
63
+ */
64
+ attemptsRemaining: number;
65
+ /** doc_ocr only: sides already accepted into the partial accumulator (['recto'] or ['verso']). */
66
+ acceptedSides?: ("recto" | "verso")[];
67
+ /** phone_otp only: the display-safe OTP send/config surface (never the verifToken). */
68
+ otp?: HostedOtpView;
69
+ }
70
+ /**
71
+ * Token-addressed hosted-page bootstrap (`GET /hosted/session`). A separate
72
+ * shape from the partner `SessionView`: `sessionId` instead of `id`,
73
+ * hosted step hints, the consent flag, and the org display name (may be `''`
74
+ * when the org lookup degrades).
75
+ */
76
+ interface HostedSessionView {
77
+ sessionId: string;
78
+ status: SessionStatus;
79
+ outcome: SessionOutcome | null;
80
+ steps: HostedStepView[];
81
+ /** ISO-8601 timestamp (Date on the server, string on the wire). */
82
+ expiresAt: string;
83
+ consentRecorded: boolean;
84
+ orgName: string;
85
+ /**
86
+ * The FIRST allowlisted web-SDK origin of the owning org (Task 12), or null
87
+ * when none is registered. The hosted page posts the SDK popup postMessage
88
+ * events (event name + sessionId ONLY) to exactly this origin — never `'*'`.
89
+ * The backend declares it required (`string | null`); optional here so
90
+ * pre-Task-12 consumers/fixtures stay valid (additive field, always on the
91
+ * wire from Task 12 onward).
92
+ */
93
+ sdkOrigin?: string | null;
94
+ /**
95
+ * Cloudflare Turnstile site key the browser must solve an execute-mode
96
+ * challenge against before submitting `liveness` (Plan A Task 5): the org's
97
+ * own widget key when the request origin is one of the org's allowlisted SDK
98
+ * origins, else the hosted widget key, else `null`. `null` means the session
99
+ * cannot be attested from the browser — the SDK sends `{sandbox: true}`,
100
+ * which the backend honours ONLY on sandbox sessions (fails closed on live).
101
+ */
102
+ turnstileSiteKey: string | null;
103
+ /**
104
+ * The session was minted with a server-bound NNI (`POST /sessions`
105
+ * `input.nni`, Plan A Task 2): `population_registry` is submitted with an
106
+ * EMPTY input and the backend reads the sealed value. `false` means the
107
+ * person must supply the NNI (hosted population form); the SDK never submits
108
+ * the registry check on an unbound session. The VALUE is never exposed. The
109
+ * backend declares it required; optional here so pre-Task-8 fixtures stay
110
+ * valid (additive field, always on the wire from Task 8 onward).
111
+ */
112
+ nniBound?: boolean;
113
+ }
114
+ /** `POST /hosted/consent` result — 201 on first record, 200 `{alreadyRecorded: true}` on replay. */
115
+ interface RecordConsentResult {
116
+ alreadyRecorded: boolean;
117
+ }
118
+ /** Consent locale — the page's `[locale]` URL segment echoed back (HostedConsentSchema picklist). */
119
+ type ConsentLocale = "ar" | "fr" | "en";
120
+ /** Per-check projection in a {@link SessionView} — enum/id only, never civil data. */
121
+ interface SessionStepView {
122
+ checkType: CheckType;
123
+ state: CheckState;
124
+ reason?: CheckReason;
125
+ calibratedScore?: number;
126
+ }
127
+ /**
128
+ * Client-facing session projection returned by
129
+ * `POST /sessions/:id/checks/:checkType`. Whitelist-only — never the client token.
130
+ */
131
+ interface SessionView {
132
+ id: string;
133
+ status: SessionStatus;
134
+ outcome: SessionOutcome | null;
135
+ steps: SessionStepView[];
136
+ /** ISO-8601 timestamp (Date on the server, string on the wire). */
137
+ expiresAt: string;
138
+ /** ISO-8601 timestamp (Date on the server, string on the wire). */
139
+ createdAt?: string;
140
+ }
141
+ /** Media class — selects size cap, MIME allowlist and promoted prefix (media.policy.ts). */
142
+ type MediaKind = "image" | "clip";
143
+ /**
144
+ * Body of `POST /sessions/:id/media`. `contentType`/`contentLength` are the
145
+ * exact values SIGNED into the presigned PUT — the PUT must send them verbatim.
146
+ * Allowlists (media.policy.ts): image → image/jpeg | image/png (5 MB cap);
147
+ * clip → video/webm | video/mp4 (15 MB cap). BARE types only — no `;codecs=` params.
148
+ */
149
+ interface PresignRequest {
150
+ kind: MediaKind;
151
+ contentType: string;
152
+ contentLength: number;
153
+ }
154
+ /** Result of a presign — the presigned PUT URL plus the pending object key. */
155
+ interface PresignUploadResult {
156
+ key: string;
157
+ uploadUrl: string;
158
+ /** Presign TTL in seconds (900 = 15 min). */
159
+ expiresIn: number;
160
+ }
161
+ /** Result of `POST /sessions/:id/media/complete` — the PROMOTED (class-prefixed) key. */
162
+ interface CompleteMediaResult {
163
+ ready: true;
164
+ /** e.g. `clips/{sessionId}/{uuid}` or `doc-images/{sessionId}/{uuid}` — submit THIS key, not the pending one. */
165
+ key: string;
166
+ }
167
+ /**
168
+ * Liveness attestation bag (attestation-verifier.service.ts). The web SDK sends
169
+ * `{channel: 'hosted_web', siteKey, turnstileToken}` — `siteKey` echoes the
170
+ * `HostedSessionView.turnstileSiteKey` the challenge was rendered with, so the
171
+ * backend picks the matching widget secret deterministically (Turnstile tokens
172
+ * are single-use: siteverify runs exactly once, never "org then global").
173
+ * `sandbox: true` is honored only on sandbox sessions; `signature` is the
174
+ * future native-SDK channel.
175
+ */
176
+ interface AttestationInput {
177
+ sandbox?: boolean;
178
+ signature?: string;
179
+ channel?: "hosted_web";
180
+ turnstileToken?: string;
181
+ /** The Turnstile site key the token was minted with (selects the verifying secret). */
182
+ siteKey?: string;
183
+ }
184
+ /** liveness executor input: a promoted `clips/…` key + optional attestation. */
185
+ interface LivenessInput {
186
+ clipKey: string;
187
+ attestation?: AttestationInput;
188
+ /** Declared capture channel — the liveness band is mobile-calibrated, so the
189
+ * backend clamps non-mobile verdicts to review (uncalibrated_capture_channel).
190
+ * Client-declared by design (not a security boundary); absent = legacy
191
+ * clients, treated as mobile server-side during the rollout window. */
192
+ captureChannel?: 'mobile' | 'desktop';
193
+ }
194
+ /**
195
+ * population_registry adapter input. `nni` is the 10-digit NNI for an UNBOUND
196
+ * session; a session minted with a server-side `input.nni` is BOUND to it
197
+ * (Plan A Task 2) — the browser submits `{}` and the backend reads the sealed
198
+ * value. Sending a DIFFERENT nni on a bound session answers 409 `nni_locked`.
199
+ */
200
+ interface PopulationInput {
201
+ nni?: string;
202
+ }
203
+ /** face_match executor input: a promoted `doc-images/…` key (the source selfie frame). */
204
+ interface FaceMatchInput {
205
+ imageKey: string;
206
+ }
207
+ /** Document side (docs.types.ts DocSide). */
208
+ type DocSide = "recto" | "verso" | "single";
209
+ /** doc_ocr executor input: a promoted `doc-images/…` key + which side it shows. */
210
+ interface DocOcrInput {
211
+ imageKey: string;
212
+ side: DocSide;
213
+ }
214
+ /**
215
+ * phone_otp executor input (Task 13): a two-phase check. `send` dispatches (or
216
+ * resends) an OTP — resolving the number from the trusted server-side prefill
217
+ * or the user-entered `phone` per the step's `numberSource`; `verify` checks
218
+ * the entered `code` against the parked token. `phone` is IGNORED for a
219
+ * `prefilled` step (a client number is never trusted as "prefilled").
220
+ */
221
+ interface PhoneOtpInput {
222
+ /** Phase selector: `send` dispatches/resends, `verify` checks the code. Defaults to `send`. */
223
+ action: "send" | "verify";
224
+ /** USER-entered E.164 number (`user_entered` / `prefilled_or_entered` sends only). */
225
+ phone?: string;
226
+ /** The code the user typed — `verify` only. */
227
+ code?: string;
228
+ /** Delivery channel override for `send` (default `sms`). */
229
+ channel?: "sms" | "whatsapp";
230
+ /** OTP message locale override for `send`. */
231
+ locale?: "ar" | "fr" | "en";
232
+ }
233
+ /** Per-check-type submission input shapes, keyed by the frozen vocabulary. */
234
+ interface CheckInputByType {
235
+ liveness: LivenessInput;
236
+ face_match: FaceMatchInput;
237
+ doc_ocr: DocOcrInput;
238
+ population_registry: PopulationInput;
239
+ phone_otp: PhoneOtpInput;
240
+ }
241
+ /**
242
+ * Body of `POST /sessions/:id/checks/:checkType` (SubmitCheckSchema).
243
+ * `forceOutcome` is SANDBOX-ONLY (plan D-C) — a live session rejects it with
244
+ * 403 `force_outcome_forbidden`.
245
+ */
246
+ interface SubmitCheckBody {
247
+ input?: Record<string, unknown>;
248
+ forceOutcome?: "pass" | "fail";
249
+ }
250
+
251
+ /**
252
+ * Strip MIME parameters: `video/webm;codecs=vp8,opus` → `video/webm`.
253
+ *
254
+ * The capture engine (Task 4) emits `clipMimeType` WITH codec parameters, but
255
+ * the presign allowlist holds BARE types only (['video/webm','video/mp4'] /
256
+ * ['image/jpeg','image/png']) and the presigned PUT signs the exact declared
257
+ * Content-Type. Exported so pages can normalize once and stay byte-consistent
258
+ * between presign and PUT.
259
+ */
260
+ declare function stripMimeParams(contentType: string): string;
261
+ /** Media-bearing check types → the input field the promoted key goes into. */
262
+ declare const MEDIA_INPUT_FIELD: {
263
+ readonly liveness: "clipKey";
264
+ readonly face_match: "imageKey";
265
+ readonly doc_ocr: "imageKey";
266
+ };
267
+ /** Check types that take an uploaded media key (population_registry does not). */
268
+ type MediaCheckType = keyof typeof MEDIA_INPUT_FIELD;
269
+ interface SubmitOptions {
270
+ /**
271
+ * Sent as `x-idempotency-key` (the header IdempotencyInterceptor reads).
272
+ * One key per LOGICAL submit — a flaky-network retry with the same key
273
+ * replays the first response without burning another attempt.
274
+ */
275
+ idempotencyKey?: string;
276
+ /** SANDBOX-ONLY deterministic override (plan D-C); a live session 403s it. */
277
+ forceOutcome?: "pass" | "fail";
278
+ }
279
+ interface UploadMedia {
280
+ kind: MediaKind;
281
+ blob: Blob;
282
+ /** May carry codec params (engine `clipMimeType`) — stripped before presign AND PUT. */
283
+ contentType: string;
284
+ }
285
+ interface HostedClientOptions {
286
+ /** API origin, e.g. `https://api.sekyro.ai` — paths are `${apiOrigin}/api/v2/...`. */
287
+ apiOrigin: string;
288
+ /** The raw session token from the hosted URL (short code; legacy `cst_` during its TTL) — sent as `x-session-token` on every API call. */
289
+ sessionToken: string;
290
+ /** Injection seam (tests / non-window contexts). Defaults to `globalThis.fetch`. */
291
+ fetch?: typeof globalThis.fetch;
292
+ /** Per-request timeout for API calls (NOT the Spaces PUT). Default 30 000 ms. */
293
+ requestTimeoutMs?: number;
294
+ /**
295
+ * Tuning for the ONLY automatic retry the client performs: 409
296
+ * `idempotency_in_progress` (a concurrent identical request is mid-flight
297
+ * server-side; the real response lands once it finishes). `attempts` counts
298
+ * retries AFTER the first try. Defaults: 5 × 400 ms.
299
+ */
300
+ inProgressRetry?: {
301
+ attempts?: number;
302
+ delayMs?: number;
303
+ };
304
+ }
305
+ /**
306
+ * Hand-authored typed client for the five session-token endpoints:
307
+ *
308
+ * GET /api/v2/hosted/session → {@link getSession}
309
+ * POST /api/v2/hosted/consent → {@link recordConsent}
310
+ * POST /api/v2/sessions/:id/media → {@link presign}
311
+ * POST /api/v2/sessions/:id/media/complete → {@link completeMedia}
312
+ * POST /api/v2/sessions/:id/checks/:checkType → {@link submitCheck}
313
+ *
314
+ * plus the bare presigned Spaces PUT ({@link uploadToSpaces}) and the
315
+ * presign→PUT→complete→submit composition ({@link uploadAndSubmit}).
316
+ *
317
+ * Envelopes (verified against sessions-docs.e2e-spec.ts):
318
+ * - success: `{success: true, data}` — unwrapped here, methods return the payload;
319
+ * - error: flat `{code, message}` → thrown as {@link HostedApiError}.
320
+ *
321
+ * The media/checks routes are `:id`-addressed while the token itself is the
322
+ * only credential the page starts with — the client learns its sessionId from
323
+ * `GET /hosted/session` (token-addressed) and lazily bootstraps it when a
324
+ * `:id` route is called first.
325
+ *
326
+ * No automatic retry EXCEPT bounded short-delay retry on 409
327
+ * `idempotency_in_progress`. Everything else — including 429 with its parsed
328
+ * `retryAfterSeconds` — is surfaced to the page to handle.
329
+ */
330
+ declare class HostedClient {
331
+ private readonly apiOrigin;
332
+ private readonly sessionToken;
333
+ private readonly fetchImpl;
334
+ private readonly requestTimeoutMs;
335
+ private readonly retryAttempts;
336
+ private readonly retryDelayMs;
337
+ private sessionId;
338
+ private bootstrap;
339
+ constructor(opts: HostedClientOptions);
340
+ /** Token-addressed bootstrap — the hosted page's first call. Caches the sessionId. */
341
+ getSession(): Promise<HostedSessionView>;
342
+ /**
343
+ * Record consent once (201; an idempotent replay answers 200 with
344
+ * `alreadyRecorded: true`). Until recorded, media presign/complete AND check
345
+ * submission answer 409 `consent_required`.
346
+ */
347
+ recordConsent(locale: ConsentLocale): Promise<RecordConsentResult>;
348
+ /**
349
+ * Presign a Spaces PUT for a new pending object. `contentType` is stripped of
350
+ * MIME parameters defensively (the allowlist holds bare types; the engine's
351
+ * `clipMimeType` carries codec params) — PUT with the SAME bare type, or the
352
+ * signed-header check rejects the upload.
353
+ */
354
+ presign(kind: MediaKind, contentType: string, contentLength: number): Promise<PresignUploadResult>;
355
+ /**
356
+ * Bare PUT to the presigned Spaces URL: EXACTLY the signed headers — the
357
+ * declared Content-Type and the blob body. NO `x-session-token` (the
358
+ * signature IS the credential; an extra header breaks nothing but leaks the
359
+ * token to a third-party host) and no JSON envelope.
360
+ *
361
+ * `contentType` is param-stripped here too (idempotent for bare types): the
362
+ * presign strips internally, so a caller composing manually with the engine's
363
+ * parameterful `clipMimeType` would otherwise sign `video/webm` but PUT
364
+ * `video/webm;codecs=…` — a signed-header mismatch S3 rejects at runtime.
365
+ *
366
+ * Timeout: 15 min (`AbortSignal.timeout(900_000)`, matching the presign TTL)
367
+ * rather than the API calls' 30 s — a 15 MB clip on a slow link legitimately
368
+ * exceeds 30 s, but a stalled in-flight socket must still be bounded (the TTL
369
+ * alone only bounds when a PUT can START).
370
+ *
371
+ * Failures are ALWAYS typed: non-2xx throws {@link HostedApiError} with the
372
+ * client-synthesized `upload_failed` (message carries a truncated S3 body
373
+ * snippet — e.g. SignatureDoesNotMatch); a mid-transfer drop → `network_error`;
374
+ * the timeout → `timeout`.
375
+ */
376
+ uploadToSpaces(uploadUrl: string, blob: Blob, contentType: string): Promise<void>;
377
+ /** Finalize an upload: the backend sniffs + promotes; returns the PROMOTED key to submit. */
378
+ completeMedia(key: string): Promise<CompleteMediaResult>;
379
+ /**
380
+ * Submit one check. Sends `{input, forceOutcome?}` (SubmitCheckSchema) and the
381
+ * optional `x-idempotency-key` header. Returns the whitelisted SessionView.
382
+ */
383
+ submitCheck<T extends CheckType>(checkType: T, input: CheckInputByType[T], opts?: SubmitOptions): Promise<SessionView>;
384
+ /**
385
+ * Convenience composition: presign → PUT → complete → submit, passing the
386
+ * PROMOTED key (from complete's response — never the pending presign key)
387
+ * into the check's media input field (`clipKey` for liveness, `imageKey` for
388
+ * face_match/doc_ocr). `extraInput` carries the remaining input fields
389
+ * (liveness `attestation`, doc_ocr `side`). The media content type is
390
+ * param-stripped ONCE and used for both presign and PUT, so the signed
391
+ * header always matches.
392
+ */
393
+ uploadAndSubmit<T extends MediaCheckType>(checkType: T, media: UploadMedia, extraInput: Omit<CheckInputByType[T], (typeof MEDIA_INPUT_FIELD)[T]>, opts?: SubmitOptions): Promise<SessionView>;
394
+ /** The token's own sessionId — cached from getSession(), lazily bootstrapped. */
395
+ private ensureSessionId;
396
+ /**
397
+ * One API request: `${apiOrigin}/api/v2${path}`, `x-session-token` always,
398
+ * AbortSignal timeout (30 s default), `{success, data}` unwrap on 2xx, flat
399
+ * `{code, message}` → {@link HostedApiError} on non-2xx. EVERY failure is
400
+ * typed: a rejected fetch → `network_error`, the timeout → `timeout`, an
401
+ * unparseable 2xx body → `unknown_error` — the page never sees a raw
402
+ * TypeError/DOMException. The ONLY automatic retry is 409
403
+ * `idempotency_in_progress` (bounded, short delay).
404
+ */
405
+ private api;
406
+ }
407
+
408
+ 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 LivenessInput as p, type MediaKind as q, type PhoneOtpInput as r, type PopulationInput as s, type PresignRequest as t, type PresignUploadResult as u, type SessionStepView as v, type SubmitCheckBody as w, type SubmitOptions as x, stripMimeParams as y };