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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CHANGELOG.md +300 -0
  2. package/LICENSE +25 -16
  3. package/README.md +111 -60
  4. package/THIRD-PARTY-NOTICES.txt +154 -0
  5. package/dist/background-monitor-A7FKJOAG.js +1 -0
  6. package/dist/camera-trait-45MJTW4K.js +1 -0
  7. package/dist/capture-constraints-B5omafmk.d.cts +44 -0
  8. package/dist/capture-constraints-B5omafmk.d.ts +44 -0
  9. package/dist/capture-session-doc-QA4DOFRF.js +1 -0
  10. package/dist/{capture-session-v3-CAoWM8iT.d.cts → capture-session-v3-CNL-GX11.d.cts} +185 -15
  11. package/dist/{capture-session-v3-BJ8ciaWl.d.ts → capture-session-v3-DaBqN8fO.d.ts} +185 -15
  12. package/dist/chunk-5ZKQHFFW.js +1 -0
  13. package/dist/chunk-7ZCZY3ZP.js +1 -0
  14. package/dist/chunk-A3FUGHAH.js +2 -0
  15. package/dist/chunk-BPE5NSQ2.js +1 -0
  16. package/dist/chunk-CJHMFPL6.js +1 -0
  17. package/dist/chunk-CQ7SKLMC.js +1 -0
  18. package/dist/chunk-DFTCAWMP.js +1 -0
  19. package/dist/chunk-DK5YPBDQ.js +1 -0
  20. package/dist/chunk-FGOVIGGL.js +1 -0
  21. package/dist/chunk-FPXL63KZ.js +1 -0
  22. package/dist/chunk-FUHDOEBP.js +1 -0
  23. package/dist/chunk-G6LKLN4U.js +1 -0
  24. package/dist/chunk-GI3UFGRQ.js +1 -0
  25. package/dist/chunk-GT2ZLGF7.js +1 -0
  26. package/dist/chunk-IG466TOP.js +1 -0
  27. package/dist/chunk-KHR4U2SZ.js +1 -0
  28. package/dist/chunk-KZBBB5B2.js +1 -0
  29. package/dist/chunk-MXWLCDFX.js +1 -0
  30. package/dist/chunk-NJML6FMD.js +1 -0
  31. package/dist/chunk-O5WKNZ2C.js +1 -0
  32. package/dist/chunk-OKWG3PVH.js +1 -0
  33. package/dist/chunk-POIQGEZM.js +1 -0
  34. package/dist/chunk-RI3E7GBN.js +1 -0
  35. package/dist/chunk-SMKCBUJL.js +1 -0
  36. package/dist/chunk-TDLIXFDT.js +1 -0
  37. package/dist/chunk-TQB3URP2.js +1 -0
  38. package/dist/chunk-U6S7SCBY.js +1 -0
  39. package/dist/chunk-U6TYL2IJ.js +1 -0
  40. package/dist/chunk-W2WD7PR2.js +1 -0
  41. package/dist/chunk-XCKE2MJL.js +1 -0
  42. package/dist/chunk-ZLWH4RBO.js +1 -0
  43. package/dist/client/index.cjs +1 -357
  44. package/dist/client/index.d.cts +6 -37
  45. package/dist/client/index.d.ts +6 -37
  46. package/dist/client/index.js +1 -15
  47. package/dist/core/index.cjs +1 -1605
  48. package/dist/core/index.d.cts +5 -4
  49. package/dist/core/index.d.ts +5 -4
  50. package/dist/core/index.js +1 -139
  51. package/dist/core/ocr/worker.bundle.js +42 -0
  52. package/dist/core/ocr/worker.cjs +42 -0
  53. package/dist/core/ocr/worker.d.cts +84 -0
  54. package/dist/core/ocr/worker.d.ts +84 -0
  55. package/dist/core/ocr/worker.js +41 -0
  56. package/dist/core/v3/detect-worker.cjs +1 -392
  57. package/dist/core/v3/detect-worker.d.cts +1 -1
  58. package/dist/core/v3/detect-worker.d.ts +1 -1
  59. package/dist/core/v3/detect-worker.js +1 -13
  60. package/dist/create-document-capture-GJXBQMTC.js +1 -0
  61. package/dist/create-portrait-capture-MOS2D7CL.js +1 -0
  62. package/dist/create-verification-BBOUYpga.d.cts +3274 -0
  63. package/dist/create-verification-COpe2hxf.d.ts +3274 -0
  64. package/dist/{detect-worker-CKXHlXx9.d.cts → detect-worker-DclNxkZT.d.cts} +6 -0
  65. package/dist/{detect-worker-CKXHlXx9.d.ts → detect-worker-DclNxkZT.d.ts} +6 -0
  66. package/dist/detector-scanic-YCDNLCGV.js +1 -0
  67. package/dist/icao-gate-CEGvJR3q.d.ts +534 -0
  68. package/dist/icao-gate-PWBMKRGC.js +1 -0
  69. package/dist/icao-gate-l40OU6x1.d.cts +534 -0
  70. package/dist/icao-policy-BgI1Y870.d.ts +71 -0
  71. package/dist/icao-policy-C7fIdRzo.d.cts +71 -0
  72. package/dist/icao-tuning-4GGVX6B4.js +1 -0
  73. package/dist/index.cjs +1 -2636
  74. package/dist/index.d.cts +110 -5
  75. package/dist/index.d.ts +110 -5
  76. package/dist/index.js +1 -28
  77. package/dist/internal/index.cjs +1 -4166
  78. package/dist/internal/index.d.cts +365 -324
  79. package/dist/internal/index.d.ts +365 -324
  80. package/dist/internal/index.js +1 -647
  81. package/dist/keyframe-rank-YAJLYJYF.js +1 -0
  82. package/dist/landmarker-KB7LVXAU.js +1 -0
  83. package/dist/mrz-band-VYHOTDHY.js +1 -0
  84. package/dist/plan-runner-35655N4Z.js +1 -0
  85. package/dist/popup/index.cjs +1 -76
  86. package/dist/popup/index.d.cts +7 -1
  87. package/dist/popup/index.d.ts +7 -1
  88. package/dist/popup/index.js +1 -11
  89. package/dist/print-AYSCRSZB.js +1 -0
  90. package/dist/scanic-ml-stub-KW7IZHUT.js +1 -0
  91. package/dist/segmenter-USLNBX65.js +1 -0
  92. package/dist/turnstile-FATNZ4AG.js +1 -0
  93. package/dist/types-Dpfg2cO8.d.cts +1699 -0
  94. package/dist/types-Dpfg2cO8.d.ts +1699 -0
  95. package/dist/upload-file-UYXOHCRG.js +1 -0
  96. package/package.json +27 -11
  97. package/sbom.cdx.json +234 -0
  98. package/dist/capture-constraints-BujkZcfb.d.cts +0 -21
  99. package/dist/capture-constraints-BujkZcfb.d.ts +0 -21
  100. package/dist/chunk-BPYVZUJA.js +0 -852
  101. package/dist/chunk-BPYVZUJA.js.map +0 -1
  102. package/dist/chunk-LOTAJDRE.js +0 -1094
  103. package/dist/chunk-LOTAJDRE.js.map +0 -1
  104. package/dist/chunk-MWNFSNMP.js +0 -52
  105. package/dist/chunk-MWNFSNMP.js.map +0 -1
  106. package/dist/chunk-NILNKLK6.js +0 -50
  107. package/dist/chunk-NILNKLK6.js.map +0 -1
  108. package/dist/chunk-NWF46H7K.js +0 -359
  109. package/dist/chunk-NWF46H7K.js.map +0 -1
  110. package/dist/chunk-WY6U7AIK.js +0 -193
  111. package/dist/chunk-WY6U7AIK.js.map +0 -1
  112. package/dist/chunk-YVFF4Q4G.js +0 -327
  113. package/dist/chunk-YVFF4Q4G.js.map +0 -1
  114. package/dist/client/index.cjs.map +0 -1
  115. package/dist/client/index.js.map +0 -1
  116. package/dist/core/index.cjs.map +0 -1
  117. package/dist/core/index.js.map +0 -1
  118. package/dist/core/v3/detect-worker.cjs.map +0 -1
  119. package/dist/core/v3/detect-worker.js.map +0 -1
  120. package/dist/create-verification-CjLnJ0w6.d.ts +0 -348
  121. package/dist/create-verification-EnZ13uY4.d.cts +0 -348
  122. package/dist/detector-scanic-4C6IEW2K.js +0 -787
  123. package/dist/detector-scanic-4C6IEW2K.js.map +0 -1
  124. package/dist/hosted-client-BpvBqu9f.d.cts +0 -408
  125. package/dist/hosted-client-BpvBqu9f.d.ts +0 -408
  126. package/dist/index.cjs.map +0 -1
  127. package/dist/index.js.map +0 -1
  128. package/dist/internal/index.cjs.map +0 -1
  129. package/dist/internal/index.js.map +0 -1
  130. package/dist/popup/index.cjs.map +0 -1
  131. package/dist/popup/index.js.map +0 -1
  132. package/dist/scanic-ml-stub-S2OZ6HEF.js +0 -10
  133. package/dist/scanic-ml-stub-S2OZ6HEF.js.map +0 -1
@@ -1,357 +1 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/client/index.ts
21
- var client_exports = {};
22
- __export(client_exports, {
23
- HostedApiError: () => HostedApiError,
24
- HostedClient: () => HostedClient,
25
- KNOWN_CODES: () => KNOWN_CODES,
26
- isKnownCode: () => isKnownCode,
27
- stripMimeParams: () => stripMimeParams
28
- });
29
- module.exports = __toCommonJS(client_exports);
30
-
31
- // src/client/errors.ts
32
- var KNOWN_CODES = [
33
- // auth / addressing (session-token.guard, controllers' own-session guards)
34
- "session_token_invalid",
35
- // 401 — missing/invalid/expired/revoked token
36
- "session_token_required",
37
- // 403 — non-session-token principal on a hosted route (defensive)
38
- "session_token_session_mismatch",
39
- // 403 — route :id differs from the token's bound session
40
- "session_not_found",
41
- // 404 — token's session missing/foreign (findOwned)
42
- // rate limiting (session-token.guard — per-token + per-IP buckets)
43
- "rate_limit_exceeded",
44
- // 429 + Retry-After header (seconds)
45
- // consent gate (Task 0 — submit AND media presign/complete)
46
- "consent_required",
47
- // 409 — record consent before uploading/submitting
48
- // submit flow (sessions.service.submitCheck)
49
- "session_not_active",
50
- // 409 — session is terminal/review; no further submissions
51
- "check_not_found",
52
- // 404 — session has no such checkType
53
- "check_already_finalized",
54
- // 409 — re-submit of a terminal/review check
55
- "check_out_of_order",
56
- // 409 — only the frontier check accepts a submission
57
- "check_type_unsupported",
58
- // 400 — no registered executor for the checkType
59
- "force_outcome_forbidden",
60
- // 403 — forceOutcome on a live session (plan D-C)
61
- "attestation_invalid",
62
- // 400 (Task 1) — Turnstile/attestation failed; reload and retry
63
- "nni_locked",
64
- // 409 (Plan A Task 2) — session is bound to a server-provided NNI; a different client NNI was sent
65
- // media (media.service)
66
- "media_content_type_not_allowed",
67
- // 400 — outside the per-kind MIME allowlist
68
- "media_too_large",
69
- // 413 — over the per-kind byte cap
70
- "media_key_invalid",
71
- // 400 — not a well-formed pending key
72
- "media_key_forbidden",
73
- // 403 — key names another session's pending space
74
- "media_not_found",
75
- // 404 — no uploaded object behind the key
76
- "media_unreadable",
77
- // 422 — magic-byte sniff rejected the object
78
- "media_session_invalid",
79
- // 400 — sessionId unusable as a key segment (never in practice)
80
- // idempotency (idempotency.interceptor — Task 2)
81
- "idempotency_key_collision",
82
- // 409 — same key, different body hash
83
- "idempotency_in_progress",
84
- // 409 — concurrent identical request mid-flight (client auto-retries)
85
- "idempotency_key_required",
86
- // 400 — only on @Idempotent({required:true}) routes (none hosted yet)
87
- // validation + fallback
88
- "validation_error",
89
- // 400 — ValibotPipe rejection (camelToSnake of 'ValidationError')
90
- "internal_error",
91
- // 500 — unhandled server error
92
- // client-synthesized (never sent by the backend)
93
- "unknown_error",
94
- // unparseable (non-JSON) response body — error OR 2xx (defensive)
95
- "upload_failed",
96
- // the bare Spaces PUT answered non-2xx
97
- "network_error",
98
- // fetch rejected: connection drop / DNS / CORS / mid-transfer (status 0)
99
- "timeout"
100
- // AbortSignal.timeout fired — API calls 30 s default, Spaces PUT 15 min (status 0)
101
- ];
102
- function isKnownCode(code) {
103
- return KNOWN_CODES.includes(code);
104
- }
105
- var HostedApiError = class extends Error {
106
- constructor(args) {
107
- super(args.message);
108
- this.name = "HostedApiError";
109
- this.status = args.status;
110
- this.code = args.code;
111
- if (args.retryAfterSeconds !== void 0) this.retryAfterSeconds = args.retryAfterSeconds;
112
- }
113
- };
114
-
115
- // src/client/hosted-client.ts
116
- var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
117
- var SPACES_PUT_TIMEOUT_MS = 9e5;
118
- var UPLOAD_ERROR_SNIPPET_CHARS = 200;
119
- var IN_PROGRESS_RETRY_ATTEMPTS = 5;
120
- var IN_PROGRESS_RETRY_DELAY_MS = 400;
121
- function stripMimeParams(contentType) {
122
- return (contentType.split(";")[0] ?? "").trim();
123
- }
124
- var MEDIA_INPUT_FIELD = {
125
- liveness: "clipKey",
126
- face_match: "imageKey",
127
- doc_ocr: "imageKey"
128
- };
129
- var HostedClient = class {
130
- constructor(opts) {
131
- this.sessionId = null;
132
- this.bootstrap = null;
133
- this.apiOrigin = opts.apiOrigin.replace(/\/+$/, "");
134
- this.sessionToken = opts.sessionToken;
135
- const impl = opts.fetch;
136
- this.fetchImpl = (input, init) => (impl ?? globalThis.fetch).call(globalThis, input, init);
137
- this.requestTimeoutMs = opts.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
138
- this.retryAttempts = opts.inProgressRetry?.attempts ?? IN_PROGRESS_RETRY_ATTEMPTS;
139
- this.retryDelayMs = opts.inProgressRetry?.delayMs ?? IN_PROGRESS_RETRY_DELAY_MS;
140
- }
141
- /** Token-addressed bootstrap — the hosted page's first call. Caches the sessionId. */
142
- async getSession() {
143
- const view = await this.api("GET", "/hosted/session");
144
- this.sessionId = view.sessionId;
145
- return view;
146
- }
147
- /**
148
- * Record consent once (201; an idempotent replay answers 200 with
149
- * `alreadyRecorded: true`). Until recorded, media presign/complete AND check
150
- * submission answer 409 `consent_required`.
151
- */
152
- async recordConsent(locale) {
153
- return this.api("POST", "/hosted/consent", { body: { locale } });
154
- }
155
- /**
156
- * Presign a Spaces PUT for a new pending object. `contentType` is stripped of
157
- * MIME parameters defensively (the allowlist holds bare types; the engine's
158
- * `clipMimeType` carries codec params) — PUT with the SAME bare type, or the
159
- * signed-header check rejects the upload.
160
- */
161
- async presign(kind, contentType, contentLength) {
162
- const id = await this.ensureSessionId();
163
- const body = { kind, contentType: stripMimeParams(contentType), contentLength };
164
- return this.api("POST", `/sessions/${id}/media`, { body });
165
- }
166
- /**
167
- * Bare PUT to the presigned Spaces URL: EXACTLY the signed headers — the
168
- * declared Content-Type and the blob body. NO `x-session-token` (the
169
- * signature IS the credential; an extra header breaks nothing but leaks the
170
- * token to a third-party host) and no JSON envelope.
171
- *
172
- * `contentType` is param-stripped here too (idempotent for bare types): the
173
- * presign strips internally, so a caller composing manually with the engine's
174
- * parameterful `clipMimeType` would otherwise sign `video/webm` but PUT
175
- * `video/webm;codecs=…` — a signed-header mismatch S3 rejects at runtime.
176
- *
177
- * Timeout: 15 min (`AbortSignal.timeout(900_000)`, matching the presign TTL)
178
- * rather than the API calls' 30 s — a 15 MB clip on a slow link legitimately
179
- * exceeds 30 s, but a stalled in-flight socket must still be bounded (the TTL
180
- * alone only bounds when a PUT can START).
181
- *
182
- * Failures are ALWAYS typed: non-2xx throws {@link HostedApiError} with the
183
- * client-synthesized `upload_failed` (message carries a truncated S3 body
184
- * snippet — e.g. SignatureDoesNotMatch); a mid-transfer drop → `network_error`;
185
- * the timeout → `timeout`.
186
- */
187
- async uploadToSpaces(uploadUrl, blob, contentType) {
188
- let res;
189
- try {
190
- res = await this.fetchImpl(uploadUrl, {
191
- method: "PUT",
192
- headers: { "content-type": stripMimeParams(contentType) },
193
- body: blob,
194
- signal: AbortSignal.timeout(SPACES_PUT_TIMEOUT_MS)
195
- });
196
- } catch (err) {
197
- throw asTransportError(err);
198
- }
199
- if (!res.ok) {
200
- const snippet = (await res.text().catch(() => "")).slice(0, UPLOAD_ERROR_SNIPPET_CHARS);
201
- throw new HostedApiError({
202
- status: res.status,
203
- code: "upload_failed",
204
- message: `media upload failed (HTTP ${res.status})${snippet ? `: ${snippet}` : ""}`
205
- });
206
- }
207
- }
208
- /** Finalize an upload: the backend sniffs + promotes; returns the PROMOTED key to submit. */
209
- async completeMedia(key) {
210
- const id = await this.ensureSessionId();
211
- return this.api("POST", `/sessions/${id}/media/complete`, {
212
- body: { key }
213
- });
214
- }
215
- /**
216
- * Submit one check. Sends `{input, forceOutcome?}` (SubmitCheckSchema) and the
217
- * optional `x-idempotency-key` header. Returns the whitelisted SessionView.
218
- */
219
- async submitCheck(checkType, input, opts = {}) {
220
- const id = await this.ensureSessionId();
221
- const body = {
222
- input,
223
- ...opts.forceOutcome !== void 0 ? { forceOutcome: opts.forceOutcome } : {}
224
- };
225
- return this.api("POST", `/sessions/${id}/checks/${checkType}`, {
226
- body,
227
- ...opts.idempotencyKey !== void 0 ? { idempotencyKey: opts.idempotencyKey } : {}
228
- });
229
- }
230
- /**
231
- * Convenience composition: presign → PUT → complete → submit, passing the
232
- * PROMOTED key (from complete's response — never the pending presign key)
233
- * into the check's media input field (`clipKey` for liveness, `imageKey` for
234
- * face_match/doc_ocr). `extraInput` carries the remaining input fields
235
- * (liveness `attestation`, doc_ocr `side`). The media content type is
236
- * param-stripped ONCE and used for both presign and PUT, so the signed
237
- * header always matches.
238
- */
239
- async uploadAndSubmit(checkType, media, extraInput, opts = {}) {
240
- const bareType = stripMimeParams(media.contentType);
241
- const presigned = await this.presign(media.kind, bareType, media.blob.size);
242
- await this.uploadToSpaces(presigned.uploadUrl, media.blob, bareType);
243
- const completed = await this.completeMedia(presigned.key);
244
- const input = {
245
- ...extraInput,
246
- [MEDIA_INPUT_FIELD[checkType]]: completed.key
247
- };
248
- return this.submitCheck(checkType, input, opts);
249
- }
250
- // ── transport ──────────────────────────────────────────────────────────────
251
- /** The token's own sessionId — cached from getSession(), lazily bootstrapped. */
252
- async ensureSessionId() {
253
- if (this.sessionId !== null) return this.sessionId;
254
- this.bootstrap ?? (this.bootstrap = this.getSession().finally(() => {
255
- this.bootstrap = null;
256
- }));
257
- return (await this.bootstrap).sessionId;
258
- }
259
- /**
260
- * One API request: `${apiOrigin}/api/v2${path}`, `x-session-token` always,
261
- * AbortSignal timeout (30 s default), `{success, data}` unwrap on 2xx, flat
262
- * `{code, message}` → {@link HostedApiError} on non-2xx. EVERY failure is
263
- * typed: a rejected fetch → `network_error`, the timeout → `timeout`, an
264
- * unparseable 2xx body → `unknown_error` — the page never sees a raw
265
- * TypeError/DOMException. The ONLY automatic retry is 409
266
- * `idempotency_in_progress` (bounded, short delay).
267
- */
268
- async api(method, path, opts = {}) {
269
- const url = `${this.apiOrigin}/api/v2${path}`;
270
- const headers = { "x-session-token": this.sessionToken };
271
- if (opts.body !== void 0) headers["content-type"] = "application/json";
272
- if (opts.idempotencyKey !== void 0) headers["x-idempotency-key"] = opts.idempotencyKey;
273
- for (let attempt = 0; ; attempt++) {
274
- let res;
275
- try {
276
- res = await this.fetchImpl(url, {
277
- method,
278
- headers,
279
- ...opts.body !== void 0 ? { body: JSON.stringify(opts.body) } : {},
280
- signal: AbortSignal.timeout(this.requestTimeoutMs)
281
- });
282
- } catch (err2) {
283
- throw asTransportError(err2);
284
- }
285
- if (res.ok) {
286
- let raw;
287
- try {
288
- raw = await res.json();
289
- } catch {
290
- throw new HostedApiError({
291
- status: res.status,
292
- code: "unknown_error",
293
- message: `response body was not valid JSON (HTTP ${res.status})`
294
- });
295
- }
296
- return unwrap(raw);
297
- }
298
- const err = await parseErrorResponse(res);
299
- if (err.code === "idempotency_in_progress" && attempt < this.retryAttempts) {
300
- if (this.retryDelayMs > 0) await sleep(this.retryDelayMs);
301
- continue;
302
- }
303
- throw err;
304
- }
305
- }
306
- };
307
- function asTransportError(err) {
308
- const name = typeof err === "object" && err !== null ? err.name : void 0;
309
- if (name === "TimeoutError") {
310
- return new HostedApiError({ status: 0, code: "timeout", message: "request timed out" });
311
- }
312
- const detail = err instanceof Error ? err.message : String(err);
313
- return new HostedApiError({
314
- status: 0,
315
- code: "network_error",
316
- message: `network request failed: ${detail}`
317
- });
318
- }
319
- function unwrap(raw) {
320
- if (raw !== null && typeof raw === "object" && "success" in raw && "data" in raw) {
321
- return raw.data;
322
- }
323
- return raw;
324
- }
325
- async function parseErrorResponse(res) {
326
- let code = "unknown_error";
327
- let message = `request failed (HTTP ${res.status})`;
328
- try {
329
- const body = await res.json();
330
- if (body !== null && typeof body === "object") {
331
- const env = body;
332
- if (typeof env.code === "string" && env.code.length > 0) code = env.code;
333
- if (typeof env.message === "string" && env.message.length > 0) message = env.message;
334
- }
335
- } catch {
336
- }
337
- const retryAfterRaw = res.headers.get("retry-after");
338
- const retryAfter = retryAfterRaw === null ? Number.NaN : Number.parseInt(retryAfterRaw, 10);
339
- return new HostedApiError({
340
- status: res.status,
341
- code,
342
- message,
343
- ...Number.isFinite(retryAfter) && retryAfter >= 0 ? { retryAfterSeconds: retryAfter } : {}
344
- });
345
- }
346
- function sleep(ms) {
347
- return new Promise((resolve) => setTimeout(resolve, ms));
348
- }
349
- // Annotate the CommonJS export names for ESM import in node:
350
- 0 && (module.exports = {
351
- HostedApiError,
352
- HostedClient,
353
- KNOWN_CODES,
354
- isKnownCode,
355
- stripMimeParams
356
- });
357
- //# sourceMappingURL=index.cjs.map
1
+ "use strict";var g=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var b=(t,e)=>()=>(t&&(e=t(t=0)),e);var I=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},z=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j(e))!G.call(t,o)&&o!==n&&g(t,o,{get:()=>e[o],enumerable:!(i=W(e,o))||i.enumerable});return t};var J=t=>z(g({},"__esModule",{value:!0}),t);var v=b(()=>{"use strict"});function _(t,e){return new Promise(n=>{let i=setTimeout(()=>n(void 0),e),o=r=>{clearTimeout(i),n(r)};try{t().then(o,()=>o(void 0))}catch{o(void 0)}})}async function M(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(t)));return Array.from(new Uint8Array(e).subarray(0,8),n=>n.toString(16).padStart(2,"0")).join("")}var R=b(()=>{"use strict";v()});var O={};I(O,{computePrint:()=>de,readHints:()=>x});function E(t,e){if(typeof t!="string")return;let n=t.trim();return n.length>0&&n.length<=e?n:void 0}async function x(){let t=navigator.userAgentData;if(typeof t?.getHighEntropyValues!="function")return;let e=await _(()=>t.getHighEntropyValues(["model","platformVersion"]),te);if(e==null)return;let n=E(e.model,ie),i=E(e.platformVersion,oe),o={...n!==void 0?{model:n}:{},...i!==void 0?{platformVersion:i}:{}};return Object.keys(o).length>0?o:void 0}async function ae(){let[t,e]=await Promise.all([new A.Thumbmark({stabilize:["private","iframe"],exclude:["permissions","webrtc","speech"],logging:!1,collect_beacon:!1,timeout:Q}).get(),x()]),n=t?.thumbmark;if(typeof n!="string"||n.length<re||n.length>se)return;let i={};for(let o of Z){let r=t.components?.[o];r==null||r.timeout==="true"||(i[o]=await M(r))}return{hash:n,c:i,...e!==void 0?{hints:e}:{}}}function ce(){return new Promise(t=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>t(),{timeout:ne}):t()})}async function de(t){return t()||(await ce(),t())?"busy":_(ae,ee)}var A,Z,Q,ee,te,ne,ie,oe,re,se,H=b(()=>{"use strict";A=require("@thumbmarkjs/thumbmarkjs");R();Z=["canvas","webgl","audio","fonts","hardware","screen","system","locales","math","plugins"],Q=2e3,ee=4e3,te=1e3,ne=2e3,ie=64,oe=32,re=8,se=128});var Me={};I(Me,{HostedApiError:()=>u,HostedClient:()=>h,KNOWN_CODES:()=>P,SEKYRO_SDK_HEADER:()=>k,icaoPolicyOf:()=>B,isInAppBrowser:()=>y,isKnownCode:()=>F,portraitIcaoGate:()=>q,stripMimeParams:()=>p});module.exports=J(Me);var f="0.1.0-rc.20";var X=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function y(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return X.test(e)}var N="sekyro.did",ue=1e4,le=()=>globalThis.process?.versions?.node,D;function V(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}}catch{}}function pe(){try{let t=localStorage.getItem(N);if(t)return t;let e=V();return e!==void 0&&localStorage.setItem(N,e),e}catch{return D??(D=V()),D}}async function me(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,n=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(n));return Array.from(new Uint8Array(i),o=>o.toString(16).padStart(2,"0")).join("").slice(0,32)}function fe(t){let e=new TextEncoder().encode(t),n="";for(let i of e)n+=String.fromCharCode(i);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ye(t){let e,n,i,o,r,c,d=()=>c?.readyState==="live",s=()=>{r!==void 0||!globalThis.crypto?.subtle||le()||d()||(r=Promise.race([Promise.resolve().then(()=>(H(),O)),new Promise(a=>setTimeout(a,ue))]).then(a=>a?.computePrint(d)).then(a=>{a==="busy"?r=void 0:o=a}).catch(()=>{}))};return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(a){a&&(e=a.slice(0,128))},noteCamera(a){n=a},noteCameraTrack(a){c=a},async deviceHeader(){try{i??(i=me().catch(()=>""));let a=[];navigator.webdriver&&a.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&a.push("headless");let l=await i,m=pe(),$={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...m?[{kind:"web_local",value:m.slice(0,128)}]:[],...l?[{kind:"web_fp",value:l}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...e?{cameraLabel:e}:{},...a.length?{signals:a}:{},...o?{print:{v:2,...o,...n?{camera:n}:{}}}:{},...y()?{inApp:!0}:{}},Y=fe(JSON.stringify($));return s(),Y}catch{return}},printReady(){return r??Promise.resolve()}}}var T=Symbol.for("sekyro.web.clientContext"),S=globalThis,w=S[T]??(S[T]=ye({sdk:`@sekyro/web@${f}`}));var P=["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"];function F(t){return P.includes(t)}var u=class extends Error{constructor(e){super(e.message),this.name="HostedApiError",this.status=e.status,this.code=e.code,e.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=e.retryAfterSeconds),e.details&&(this.details=e.details)}};function L(t,e,n=Math.random){let i=(t??e)*1e3,o=Math.min(Math.max(i,500),2e4),r=Math.round(o*(1+(n()*2-1)*.25));return Math.min(Math.max(r,500),2e4)}var he=6e4,U=4,ge=3e4,be=9e5,_e=200,Te=5,Se=400,we=new Set(["server_busy","request_timeout"]),Pe=2;function p(t){return(t.split(";")[0]??"").trim()}var Ce={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},k=`@sekyro/web/${f}`,ke=k,h=class{constructor(e){this.sessionId=null;this.bootstrap=null;this.captureNonces=[];this.captureFetch=null;this.reportedIssues=new Map;this.apiOrigin=e.apiOrigin.replace(/\/+$/,""),this.sessionToken=e.sessionToken;let n=e.fetch;this.fetchImpl=(i,o)=>(n??globalThis.fetch).call(globalThis,i,o),this.requestTimeoutMs=e.requestTimeoutMs??ge,this.retryAttempts=e.inProgressRetry?.attempts??Te,this.retryDelayMs=e.inProgressRetry?.delayMs??Se,this.random=e.random??Math.random}async getSession(){let e=await this.api("GET","/hosted/session");return this.sessionId=e.sessionId,e}async recordConsent(e){return this.api("POST","/hosted/consent",{body:{locale:e},busyRetry:!0})}async reportCameraUnavailable(e){return this.api("POST","/hosted/camera-unavailable",{body:{cause:e}})}async reportCaptureIssue(e){let n=typeof e.name=="string"?e.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",i=typeof e.engineKind=="string"&&/^[a-z_]{1,32}$/.test(e.engineKind)?e.engineKind:void 0,o=typeof e.attempt=="number"&&Number.isInteger(e.attempt)&&e.attempt>=0&&e.attempt<=1e3?e.attempt:void 0,r=[e.check,o??"",e.kind,n,e.phase??""].join("|"),c=this.reportedIssues.get(r);if(c!==void 0)return c;let d={check:e.check,kind:e.kind,...n!==""?{name:n}:{},...e.phase!==void 0?{phase:e.phase}:{},...i!==void 0?{engineKind:i}:{},...o!==void 0?{attempt:o}:{},...e.formFactor!==void 0?{formFactor:e.formFactor}:{}},s=this.api("POST","/hosted/capture-issue",{body:d,empty:!0}).catch(()=>{this.reportedIssues.delete(r)});return this.reportedIssues.set(r,s),s}async choose(e,n){let i=await this.api("POST","/hosted/choice",{body:{nodeId:e,option:n},busyRetry:!0});return this.sessionId=i.sessionId,i}async confirmIdentity(e){return this.api("POST","/hosted/identity/confirm",{body:{decision:e}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(e,n,i,o={}){let r=await this.ensureSessionId(),c={kind:e,contentType:p(n),contentLength:i,...o.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${r}/media`,{body:c})}armCapture(e=2){this.fillCaptureNonces(e)}async presignCapture(e,n,i,o={}){let r=await this.ensureSessionId(),c=await this.takeCaptureNonce(),d=c===void 0?void 0:{nonce:c,...o.engine!==void 0?{engine:o.engine.slice(0,32)}:{},...o.durationMs!==void 0&&Number.isFinite(o.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(o.durationMs)))}:{}},s={kind:e,contentType:p(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${r}/media`,{body:s})}async takeCaptureNonce(){let e=()=>{let n=Date.now();return this.captureNonces=this.captureNonces.filter(i=>i.expiresAt-he>n),this.captureNonces.shift()?.nonce};for(let n=0;n<2;n++){let i=e();if(i!==void 0)return i;await this.fillCaptureNonces(1)}return e()}fillCaptureNonces(e){return this.captureFetch??(this.captureFetch=(async()=>{try{let n=await this.ensureSessionId(),i=await this.api("POST",`/sessions/${n}/media/capture-nonces`,{body:{count:Math.min(U,Math.max(1,e))}}),o=Date.now()+Math.max(0,i.expiresIn)*1e3;for(let r of Array.isArray(i.nonces)?i.nonces:[])typeof r=="string"&&r.length>0&&this.captureNonces.push({nonce:r,expiresAt:o});this.captureNonces=this.captureNonces.slice(-U)}catch{}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,n,i){let o;try{o=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":p(i)},body:n,signal:AbortSignal.timeout(be)})}catch(r){throw C(r)}if(!o.ok){let r=(await o.text().catch(()=>"")).slice(0,_e);throw new u({status:o.status,code:"upload_failed",message:`media upload failed (HTTP ${o.status})${r?`: ${r}`:""}`})}}async completeMedia(e){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:e}})}async submitCheck(e,n,i={}){let o=await this.ensureSessionId(),r={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${o}/checks/${e}`,{body:r,idempotencyKey:i.idempotencyKey,busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(e,n,i,o={}){let r=p(n.contentType),c=await this.presign(n.kind,r,n.blob.size);await this.uploadToSpaces(c.uploadUrl,n.blob,r);let d=await this.completeMedia(c.key),s={...i,[Ce[e]]:d.key};return this.submitCheck(e,s,o)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(e,n,i={}){let o=e==="GET"||i.busyRetry===!0,r=`${this.apiOrigin}/api/v2${n}`,c={"x-session-token":this.sessionToken,"x-sekyro-sdk":ke};i.body!==void 0&&(c["content-type"]="application/json"),i.idempotencyKey!==void 0&&(c["x-idempotency-key"]=i.idempotencyKey);try{let d=w.timezone();d!==void 0&&(c["sekyro-client-timezone"]=d)}catch{}try{let d=await w.deviceHeader();d!==void 0&&(c["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let s;try{s=await this.fetchImpl(r,{method:e,headers:c,...i.body!==void 0?{body:JSON.stringify(i.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw C(l)}if(s.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await s.blob()}catch(m){throw C(m)}let l;try{l=await s.json()}catch{throw new u({status:s.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${s.status})`})}return Ie(l)}let a=await ve(s);if(a.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await K(this.retryDelayMs);continue}if(o&&a.status===503&&we.has(a.code)){o=!1,await K(L(a.retryAfterSeconds,Pe,this.random));continue}throw a}}};function C(t){if((typeof t=="object"&&t!==null?t.name:void 0)==="TimeoutError")return new u({status:0,code:"timeout",message:"request timed out"});let n=t instanceof Error?t.message:String(t);return new u({status:0,code:"network_error",message:`network request failed: ${n}`})}function Ie(t){return t!==null&&typeof t=="object"&&"success"in t&&"data"in t?t.data:t}async function ve(t){let e="unknown_error",n=`request failed (HTTP ${t.status})`,i=Number.NaN,o;try{let d=await t.json();if(d!==null&&typeof d=="object"){let s=d;typeof s.code=="string"&&s.code.length>0&&(e=s.code),typeof s.message=="string"&&s.message.length>0&&(n=s.message),typeof s.retryAfterSeconds=="number"&&(i=s.retryAfterSeconds),Array.isArray(s.details?.issues)&&(o=s.details)}}catch{}let r=t.headers.get("retry-after"),c=r===null?Math.floor(i):Number.parseInt(r,10);return new u({status:t.status,code:e,message:n,...Number.isFinite(c)&&c>=0?{retryAfterSeconds:c}:{},details:o})}function K(t){return new Promise(e=>setTimeout(e,t))}function B(t){let e=t?.portrait,n=e?.icao,i=e?.purpose==="id_document";return n==null?i?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:i||n.profile==="id_document"?"id_document":"selfie"}}function q(t){return{...t.baselineEyeOpenness!==void 0?{baselineEyeOpenness:t.baselineEyeOpenness}:{},criteria:t.verdict??{},...t.backgroundCheck!==void 0?{backgroundCheck:t.backgroundCheck}:{}}}0&&(module.exports={HostedApiError,HostedClient,KNOWN_CODES,SEKYRO_SDK_HEADER,icaoPolicyOf,isInAppBrowser,isKnownCode,portraitIcaoGate,stripMimeParams});
@@ -1,39 +1,8 @@
1
- export { A as AttestationInput, i as CheckInputByType, C as CheckReason, a as CheckState, b as CheckType, j as CompleteMediaResult, k as ConsentLocale, l as DocOcrInput, D as DocReason, m as DocSide, n as FaceMatchInput, F as FaceMatchReason, g as HostedClient, o as HostedClientOptions, H as HostedOtpView, c as HostedSessionView, d as HostedStepView, p as LivenessInput, L as LivenessReason, M as MediaCheckType, q as MediaKind, r as PhoneOtpInput, P as PhoneOtpReason, s as PopulationInput, e as PopulationReason, t as PresignRequest, u as PresignUploadResult, R as RecordConsentResult, S as SessionOutcome, f as SessionStatus, v as SessionStepView, h as SessionView, w as SubmitCheckBody, x as SubmitOptions, U as UploadMedia, y as stripMimeParams } from '../hosted-client-BpvBqu9f.cjs';
1
+ export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-l40OU6x1.cjs';
2
+ export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-C7fIdRzo.cjs';
3
+ export { A as AcceptedDocumentType, a as AttestationInput, C as CaptureContext, b as CaptureMode, c as CaptureNoncesResult, d as CaptureProof, e as CheckInputByType, f as CheckReason, g as CheckState, h as CheckType, i as CompleteMediaResult, j as ConsentLocale, k as ContactChannel, D as DecisionReason, l as DocDeviceRead, m as DocOcrInput, n as DocReason, o as DocSide, E as EidAfterPass, p as EidAuthInput, q as EidReason, r as EmailOtpInput, s as EmailOtpReason, F as FaceMatchInput, t as FaceMatchReason, H as HostedAcceptedDocuments, u as HostedCaptureTuning, v as HostedConsentView, w as HostedDocumentCaptureTuning, x as HostedDocumentScanTuning, y as HostedDocumentsView, z as HostedEidView, B as HostedEmailOtpView, G as HostedFlowRef, I as HostedIcaoPolicy, J as HostedIntegrity, K as HostedLivePhotoTuning, L as HostedNativeCaptureTuning, M as HostedOcrTuning, N as HostedOtpView, O as HostedPlanView, P as HostedPortraitPendingFix, Q as HostedPortraitView, R as HostedSessionView, S as HostedStepView, T as HostedVoiceLocale, U as HostedVoiceView, V as IcaoCriterion, W as IcaoReportEntry, X as IdentityConfirmDecision, Y as IdentityMethod, Z as IdentitySummarySource, _ as IdentitySummaryView, $ as LivenessCaptureInput, a0 as LivenessInput, a1 as LivenessReason, a2 as MatchReason, a3 as MediaKind, a4 as MethodChoiceView, a5 as NationalEidOption, a6 as NfcChipReason, a7 as NfcStepView, a8 as OtpChoiceView, a9 as PhoneCountryRule, aa as PhoneFormat, ab as PhoneOtpInput, ac as PhoneOtpReason, ad as PhotoSource, ae as PhotoSourcePick, af as PlanAttempts, ag as PlanChoiceKind, ah as PlanChoiceOption, ai as PlanChoiceView, aj as PlanSectionView, ak as PlanStepView, al as PolicyFailureReason, am as PopulationInput, an as PopulationReason, ao as PortraitFix, ap as PortraitFixReviewInput, aq as PortraitIcaoInput, ar as PortraitIcaoReason, as as PortraitOutputFormat, at as PresignRequest, au as PresignUploadResult, av as RecordConsentResult, aw as ResolvedCaptureMode, ax as SessionFailureReason, ay as SessionOutcome, az as SessionStatus, aA as SessionStepView, aB as SessionView, aC as StepSection, aD as SubmitCheckBody, aE as VerificationAssurance, aF as VerificationLevel } from '../types-Dpfg2cO8.cjs';
2
4
 
3
- /**
4
- * Every error code the hosted page can receive from the session-token surface.
5
- * A closed string-literal union — switch over {@link KnownCode} with a `never`
6
- * default arm for compile-checked exhaustiveness.
7
- */
8
- 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", "nni_locked", "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"];
9
- /** Closed union of {@link KNOWN_CODES} — exhaustively switchable. */
10
- type KnownCode = (typeof KNOWN_CODES)[number];
11
- /** Narrow an arbitrary wire code to the known union (unknown codes stay `string`). */
12
- declare function isKnownCode(code: string): code is KnownCode;
13
- /**
14
- * Typed transport error: EVERY failure surfaces as one of these — non-2xx
15
- * responses, rejected fetches, timeouts, and unparseable bodies alike. The
16
- * hosted page never sees a raw TypeError/DOMException from the client.
17
- *
18
- * - `code` — the public envelope's `code`, or a client-synthesized fallback
19
- * ('unknown_error' / 'upload_failed' / 'network_error' / 'timeout'). Typed
20
- * `string` because the wire may grow codes; narrow with {@link isKnownCode}
21
- * before an exhaustive switch.
22
- * - `status` — the HTTP status, or 0 when no response arrived at all
23
- * ('network_error' / 'timeout').
24
- * - `retryAfterSeconds` — parsed from the `Retry-After` header when present
25
- * (rate-limit 429s always set it).
26
- */
27
- declare class HostedApiError extends Error {
28
- readonly status: number;
29
- readonly code: string;
30
- readonly retryAfterSeconds?: number;
31
- constructor(args: {
32
- status: number;
33
- code: string;
34
- message: string;
35
- retryAfterSeconds?: number;
36
- });
37
- }
5
+ /** The page runs inside an app's WebView (WhatsApp, Instagram, Facebook, TikTok, Snapchat, LINE, LinkedIn, WeChat, an Android WebView…). */
6
+ declare function isInAppBrowser(userAgent?: string): boolean;
38
7
 
39
- export { HostedApiError, KNOWN_CODES, type KnownCode, isKnownCode };
8
+ export { isInAppBrowser };
@@ -1,39 +1,8 @@
1
- export { A as AttestationInput, i as CheckInputByType, C as CheckReason, a as CheckState, b as CheckType, j as CompleteMediaResult, k as ConsentLocale, l as DocOcrInput, D as DocReason, m as DocSide, n as FaceMatchInput, F as FaceMatchReason, g as HostedClient, o as HostedClientOptions, H as HostedOtpView, c as HostedSessionView, d as HostedStepView, p as LivenessInput, L as LivenessReason, M as MediaCheckType, q as MediaKind, r as PhoneOtpInput, P as PhoneOtpReason, s as PopulationInput, e as PopulationReason, t as PresignRequest, u as PresignUploadResult, R as RecordConsentResult, S as SessionOutcome, f as SessionStatus, v as SessionStepView, h as SessionView, w as SubmitCheckBody, x as SubmitOptions, U as UploadMedia, y as stripMimeParams } from '../hosted-client-BpvBqu9f.js';
1
+ export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-CEGvJR3q.js';
2
+ export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-BgI1Y870.js';
3
+ export { A as AcceptedDocumentType, a as AttestationInput, C as CaptureContext, b as CaptureMode, c as CaptureNoncesResult, d as CaptureProof, e as CheckInputByType, f as CheckReason, g as CheckState, h as CheckType, i as CompleteMediaResult, j as ConsentLocale, k as ContactChannel, D as DecisionReason, l as DocDeviceRead, m as DocOcrInput, n as DocReason, o as DocSide, E as EidAfterPass, p as EidAuthInput, q as EidReason, r as EmailOtpInput, s as EmailOtpReason, F as FaceMatchInput, t as FaceMatchReason, H as HostedAcceptedDocuments, u as HostedCaptureTuning, v as HostedConsentView, w as HostedDocumentCaptureTuning, x as HostedDocumentScanTuning, y as HostedDocumentsView, z as HostedEidView, B as HostedEmailOtpView, G as HostedFlowRef, I as HostedIcaoPolicy, J as HostedIntegrity, K as HostedLivePhotoTuning, L as HostedNativeCaptureTuning, M as HostedOcrTuning, N as HostedOtpView, O as HostedPlanView, P as HostedPortraitPendingFix, Q as HostedPortraitView, R as HostedSessionView, S as HostedStepView, T as HostedVoiceLocale, U as HostedVoiceView, V as IcaoCriterion, W as IcaoReportEntry, X as IdentityConfirmDecision, Y as IdentityMethod, Z as IdentitySummarySource, _ as IdentitySummaryView, $ as LivenessCaptureInput, a0 as LivenessInput, a1 as LivenessReason, a2 as MatchReason, a3 as MediaKind, a4 as MethodChoiceView, a5 as NationalEidOption, a6 as NfcChipReason, a7 as NfcStepView, a8 as OtpChoiceView, a9 as PhoneCountryRule, aa as PhoneFormat, ab as PhoneOtpInput, ac as PhoneOtpReason, ad as PhotoSource, ae as PhotoSourcePick, af as PlanAttempts, ag as PlanChoiceKind, ah as PlanChoiceOption, ai as PlanChoiceView, aj as PlanSectionView, ak as PlanStepView, al as PolicyFailureReason, am as PopulationInput, an as PopulationReason, ao as PortraitFix, ap as PortraitFixReviewInput, aq as PortraitIcaoInput, ar as PortraitIcaoReason, as as PortraitOutputFormat, at as PresignRequest, au as PresignUploadResult, av as RecordConsentResult, aw as ResolvedCaptureMode, ax as SessionFailureReason, ay as SessionOutcome, az as SessionStatus, aA as SessionStepView, aB as SessionView, aC as StepSection, aD as SubmitCheckBody, aE as VerificationAssurance, aF as VerificationLevel } from '../types-Dpfg2cO8.js';
2
4
 
3
- /**
4
- * Every error code the hosted page can receive from the session-token surface.
5
- * A closed string-literal union — switch over {@link KnownCode} with a `never`
6
- * default arm for compile-checked exhaustiveness.
7
- */
8
- 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", "nni_locked", "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"];
9
- /** Closed union of {@link KNOWN_CODES} — exhaustively switchable. */
10
- type KnownCode = (typeof KNOWN_CODES)[number];
11
- /** Narrow an arbitrary wire code to the known union (unknown codes stay `string`). */
12
- declare function isKnownCode(code: string): code is KnownCode;
13
- /**
14
- * Typed transport error: EVERY failure surfaces as one of these — non-2xx
15
- * responses, rejected fetches, timeouts, and unparseable bodies alike. The
16
- * hosted page never sees a raw TypeError/DOMException from the client.
17
- *
18
- * - `code` — the public envelope's `code`, or a client-synthesized fallback
19
- * ('unknown_error' / 'upload_failed' / 'network_error' / 'timeout'). Typed
20
- * `string` because the wire may grow codes; narrow with {@link isKnownCode}
21
- * before an exhaustive switch.
22
- * - `status` — the HTTP status, or 0 when no response arrived at all
23
- * ('network_error' / 'timeout').
24
- * - `retryAfterSeconds` — parsed from the `Retry-After` header when present
25
- * (rate-limit 429s always set it).
26
- */
27
- declare class HostedApiError extends Error {
28
- readonly status: number;
29
- readonly code: string;
30
- readonly retryAfterSeconds?: number;
31
- constructor(args: {
32
- status: number;
33
- code: string;
34
- message: string;
35
- retryAfterSeconds?: number;
36
- });
37
- }
5
+ /** The page runs inside an app's WebView (WhatsApp, Instagram, Facebook, TikTok, Snapchat, LINE, LinkedIn, WeChat, an Android WebView…). */
6
+ declare function isInAppBrowser(userAgent?: string): boolean;
38
7
 
39
- export { HostedApiError, KNOWN_CODES, type KnownCode, isKnownCode };
8
+ export { isInAppBrowser };
@@ -1,15 +1 @@
1
- import {
2
- HostedApiError,
3
- HostedClient,
4
- KNOWN_CODES,
5
- isKnownCode,
6
- stripMimeParams
7
- } from "../chunk-YVFF4Q4G.js";
8
- export {
9
- HostedApiError,
10
- HostedClient,
11
- KNOWN_CODES,
12
- isKnownCode,
13
- stripMimeParams
14
- };
15
- //# sourceMappingURL=index.js.map
1
+ import{a as t,b as o,c as i,e as n,f as s,g as a,h as r,i as p}from"../chunk-NJML6FMD.js";import{b as e}from"../chunk-ZLWH4RBO.js";export{i as HostedApiError,a as HostedClient,t as KNOWN_CODES,s as SEKYRO_SDK_HEADER,r as icaoPolicyOf,e as isInAppBrowser,o as isKnownCode,p as portraitIcaoGate,n as stripMimeParams};