@sekyro/web 0.1.0-rc.3 → 0.1.0-rc.30

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 (137) hide show
  1. package/CHANGELOG.md +427 -0
  2. package/LICENSE +25 -16
  3. package/README.md +150 -62
  4. package/THIRD-PARTY-NOTICES.txt +154 -0
  5. package/dist/background-monitor-A7FKJOAG.js +1 -0
  6. package/dist/barcode-detect-C5IOXMKI.js +1 -0
  7. package/dist/camera-trait-V4UAOPIQ.js +1 -0
  8. package/dist/capture-constraints-CVqpMNGA.d.cts +48 -0
  9. package/dist/capture-constraints-CVqpMNGA.d.ts +48 -0
  10. package/dist/capture-session-doc-ESEZJBQM.js +1 -0
  11. package/dist/{capture-session-v3-CvIfcwST.d.ts → capture-session-v3-CTQL6eFd.d.cts} +259 -13
  12. package/dist/{capture-session-v3-COIO_F2w.d.cts → capture-session-v3-DHlOE6cS.d.ts} +259 -13
  13. package/dist/challenge-frame-YAQJ5YMB.js +1 -0
  14. package/dist/chunk-2LDOXGY3.js +1 -0
  15. package/dist/chunk-33KKMPJ5.js +1 -0
  16. package/dist/chunk-3LMJ4335.js +1 -0
  17. package/dist/chunk-53POX7U4.js +1 -0
  18. package/dist/chunk-7252SFZ6.js +1 -0
  19. package/dist/chunk-7QZWBDI5.js +1 -0
  20. package/dist/chunk-A7QFTU6M.js +1 -0
  21. package/dist/chunk-CJHMFPL6.js +1 -0
  22. package/dist/chunk-CMXN4SOZ.js +1 -0
  23. package/dist/chunk-CPUECYAJ.js +1 -0
  24. package/dist/chunk-DFTCAWMP.js +1 -0
  25. package/dist/chunk-DK5YPBDQ.js +1 -0
  26. package/dist/chunk-FPXL63KZ.js +1 -0
  27. package/dist/chunk-FSSMUAKC.js +1 -0
  28. package/dist/chunk-G6LKLN4U.js +1 -0
  29. package/dist/chunk-GFJATPUR.js +1 -0
  30. package/dist/chunk-GI3UFGRQ.js +1 -0
  31. package/dist/chunk-JLVZ35QK.js +2 -0
  32. package/dist/chunk-KA43AAM7.js +1 -0
  33. package/dist/chunk-KXFHVAYQ.js +1 -0
  34. package/dist/chunk-ODI4A5K4.js +1 -0
  35. package/dist/chunk-OEQJ62CC.js +3 -0
  36. package/dist/chunk-POIQGEZM.js +1 -0
  37. package/dist/chunk-RI3E7GBN.js +1 -0
  38. package/dist/chunk-S5BUCUZ4.js +1 -0
  39. package/dist/chunk-SLKRT74K.js +1 -0
  40. package/dist/chunk-SMKCBUJL.js +1 -0
  41. package/dist/chunk-SX7TUC3V.js +1 -0
  42. package/dist/chunk-TSA6GHUG.js +1 -0
  43. package/dist/chunk-UTPUHE4J.js +1 -0
  44. package/dist/chunk-VVUQ4PFU.js +1 -0
  45. package/dist/chunk-VWGKUQ3C.js +1 -0
  46. package/dist/chunk-ZKF2XMNX.js +1 -0
  47. package/dist/client/index.cjs +1 -357
  48. package/dist/client/index.d.cts +6 -37
  49. package/dist/client/index.d.ts +6 -37
  50. package/dist/client/index.js +1 -15
  51. package/dist/clip-inspect-DLJXVKV6.js +1 -0
  52. package/dist/core/index.cjs +1 -1606
  53. package/dist/core/index.d.cts +5 -4
  54. package/dist/core/index.d.ts +5 -4
  55. package/dist/core/index.js +1 -139
  56. package/dist/core/ocr/worker.bundle.js +42 -0
  57. package/dist/core/ocr/worker.cjs +42 -0
  58. package/dist/core/ocr/worker.d.cts +84 -0
  59. package/dist/core/ocr/worker.d.ts +84 -0
  60. package/dist/core/ocr/worker.js +41 -0
  61. package/dist/core/v3/detect-worker.cjs +1 -392
  62. package/dist/core/v3/detect-worker.d.cts +1 -1
  63. package/dist/core/v3/detect-worker.d.ts +1 -1
  64. package/dist/core/v3/detect-worker.js +1 -13
  65. package/dist/create-document-capture-V7XCRRDV.js +1 -0
  66. package/dist/create-portrait-capture-5VGYZUOK.js +1 -0
  67. package/dist/create-verification-CGBe2yLE.d.cts +3719 -0
  68. package/dist/create-verification-aoY2QoRx.d.ts +3719 -0
  69. package/dist/{detect-worker-CKXHlXx9.d.ts → detect-worker-CHqsPJoM.d.cts} +25 -2
  70. package/dist/{detect-worker-CKXHlXx9.d.cts → detect-worker-CHqsPJoM.d.ts} +25 -2
  71. package/dist/detector-scanic-SE3CL55N.js +1 -0
  72. package/dist/icao-gate-DveU9Cr8.d.ts +573 -0
  73. package/dist/icao-gate-T3BTOKFJ.js +1 -0
  74. package/dist/icao-gate-xyWB7dz2.d.cts +573 -0
  75. package/dist/icao-policy-BWu1JLgi.d.cts +80 -0
  76. package/dist/icao-policy-OOEQDG9_.d.ts +80 -0
  77. package/dist/icao-tuning-4ETMF53W.js +1 -0
  78. package/dist/index.cjs +3 -2649
  79. package/dist/index.d.cts +138 -5
  80. package/dist/index.d.ts +138 -5
  81. package/dist/index.js +1 -28
  82. package/dist/internal/index.cjs +3 -4179
  83. package/dist/internal/index.d.cts +390 -371
  84. package/dist/internal/index.d.ts +390 -371
  85. package/dist/internal/index.js +1 -647
  86. package/dist/keyframe-rank-YAJLYJYF.js +1 -0
  87. package/dist/landmarker-KB7LVXAU.js +1 -0
  88. package/dist/mrz-band-VYHOTDHY.js +1 -0
  89. package/dist/plan-runner-IXCKR4DB.js +1 -0
  90. package/dist/popup/index.cjs +1 -76
  91. package/dist/popup/index.d.cts +9 -3
  92. package/dist/popup/index.d.ts +9 -3
  93. package/dist/popup/index.js +1 -11
  94. package/dist/print-SEWS3VHQ.js +1 -0
  95. package/dist/scanic-ml-stub-KW7IZHUT.js +1 -0
  96. package/dist/segmenter-USLNBX65.js +1 -0
  97. package/dist/types-CezFEXzl.d.cts +2103 -0
  98. package/dist/types-CezFEXzl.d.ts +2103 -0
  99. package/dist/upload-file-EGXXM6TQ.js +1 -0
  100. package/package.json +30 -11
  101. package/sbom.cdx.json +349 -0
  102. package/dist/capture-constraints-BujkZcfb.d.cts +0 -21
  103. package/dist/capture-constraints-BujkZcfb.d.ts +0 -21
  104. package/dist/chunk-7TC6TOZ4.js +0 -1095
  105. package/dist/chunk-7TC6TOZ4.js.map +0 -1
  106. package/dist/chunk-FIXX2AXC.js +0 -864
  107. package/dist/chunk-FIXX2AXC.js.map +0 -1
  108. package/dist/chunk-MWNFSNMP.js +0 -52
  109. package/dist/chunk-MWNFSNMP.js.map +0 -1
  110. package/dist/chunk-NILNKLK6.js +0 -50
  111. package/dist/chunk-NILNKLK6.js.map +0 -1
  112. package/dist/chunk-NWF46H7K.js +0 -359
  113. package/dist/chunk-NWF46H7K.js.map +0 -1
  114. package/dist/chunk-WY6U7AIK.js +0 -193
  115. package/dist/chunk-WY6U7AIK.js.map +0 -1
  116. package/dist/chunk-YVFF4Q4G.js +0 -327
  117. package/dist/chunk-YVFF4Q4G.js.map +0 -1
  118. package/dist/client/index.cjs.map +0 -1
  119. package/dist/client/index.js.map +0 -1
  120. package/dist/core/index.cjs.map +0 -1
  121. package/dist/core/index.js.map +0 -1
  122. package/dist/core/v3/detect-worker.cjs.map +0 -1
  123. package/dist/core/v3/detect-worker.js.map +0 -1
  124. package/dist/create-verification-CP18eq1Q.d.cts +0 -348
  125. package/dist/create-verification-CswF2As-.d.ts +0 -348
  126. package/dist/detector-scanic-4C6IEW2K.js +0 -787
  127. package/dist/detector-scanic-4C6IEW2K.js.map +0 -1
  128. package/dist/hosted-client-BpvBqu9f.d.cts +0 -408
  129. package/dist/hosted-client-BpvBqu9f.d.ts +0 -408
  130. package/dist/index.cjs.map +0 -1
  131. package/dist/index.js.map +0 -1
  132. package/dist/internal/index.cjs.map +0 -1
  133. package/dist/internal/index.js.map +0 -1
  134. package/dist/popup/index.cjs.map +0 -1
  135. package/dist/popup/index.js.map +0 -1
  136. package/dist/scanic-ml-stub-S2OZ6HEF.js +0 -10
  137. 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 j=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var b=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},J=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of z(e))!X.call(t,i)&&i!==n&&g(t,i,{get:()=>e[i],enumerable:!(o=j(e,i))||o.enumerable});return t};var Q=t=>J(g({},"__esModule",{value:!0}),t);var v=b(()=>{"use strict"});function _(t,e){return new Promise(n=>{let o=setTimeout(()=>n(void 0),e),i=r=>{clearTimeout(o),n(r)};try{t().then(i,()=>i(void 0))}catch{i(void 0)}})}async function R(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 E=b(()=>{"use strict";v()});var H={};M(H,{computePrint:()=>fe,readHints:()=>O});function A(t,e){if(typeof t!="string")return;let n=t.trim();return n.length>0&&n.length<=e?n:void 0}async function O(){let t=navigator.userAgentData;if(typeof t?.getHighEntropyValues!="function")return;let e=await _(()=>t.getHighEntropyValues(["model","platformVersion"]),se);if(e==null)return;let n=A(e.model,ce),o=A(e.platformVersion,de),i={...n!==void 0?{model:n}:{},...o!==void 0?{platformVersion:o}:{}};return Object.keys(i).length>0?i:void 0}async function pe(){let[t,e]=await Promise.all([new x.Thumbmark({stabilize:["private","iframe"],exclude:["permissions","webrtc","speech"],logging:!1,collect_beacon:!1,timeout:ie}).get(),O()]),n=t?.thumbmark;if(typeof n!="string"||n.length<ue||n.length>le)return;let o={};for(let i of oe){let r=t.components?.[i];r==null||r.timeout==="true"||(o[i]=await R(r))}return{hash:n,c:o,...e!==void 0?{hints:e}:{}}}function me(){return new Promise(t=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>t(),{timeout:ae}):t()})}async function fe(t){return t()||(await me(),t())?"busy":_(pe,re)}var x,oe,ie,re,se,ae,ce,de,ue,le,N=b(()=>{"use strict";x=require("@thumbmarkjs/thumbmarkjs");E();oe=["canvas","webgl","audio","fonts","hardware","screen","system","locales","math","plugins"],ie=2e3,re=4e3,se=1e3,ae=2e3,ce=64,de=32,ue=8,le=128});var He={};M(He,{HostedApiError:()=>u,HostedClient:()=>h,KNOWN_CODES:()=>P,SEKYRO_SDK_HEADER:()=>k,icaoPolicyOf:()=>$,isInAppBrowser:()=>y,isKnownCode:()=>L,portraitIcaoGate:()=>G,stripMimeParams:()=>p});module.exports=Q(He);var Z=600;function I(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let t=navigator.userAgentData,e=t?.mobile||/Android|i(Pad)?OS/.test(String(t?.platform)),n=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(n))return"phone";if(/iPad/i.test(n))return"tablet";if(/Android/i.test(n))return/Mobile/i.test(n)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(n))return"phone";if(!e){if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(n))return"tablet";if(/Windows NT|CrOS/.test(n)||!te())return"desktop"}let o=ee();return o>0&&o<Z?"phone":"tablet"}function ee(){try{let t=window.screen,e=Number(t?.width??0),n=Number(t?.height??0);return e>0&&n>0?Math.min(e,n):0}catch{return 0}}function te(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var f="0.1.0-rc.30";var ne=/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 ne.test(e)}var V="sekyro.did",ye=1e4,he=()=>globalThis.process?.versions?.node,D;function F(){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 ge(){try{let t=localStorage.getItem(V);if(t)return t;let e=F();return e!==void 0&&localStorage.setItem(V,e),e}catch{return D??(D=F()),D}}async function be(){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]),o=await t.digest("SHA-256",new TextEncoder().encode(n));return Array.from(new Uint8Array(o),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function _e(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}function Te(t){let e=new TextEncoder().encode(t),n="";for(let o of e)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Se(t){let e,n,o,i,r,a,d=()=>a?.readyState==="live",s=()=>{r!==void 0||!globalThis.crypto?.subtle||he()||d()||(r=Promise.race([Promise.resolve().then(()=>(N(),H)),new Promise(c=>setTimeout(c,ye))]).then(c=>c?.computePrint(d)).then(c=>{c==="busy"?r=void 0:i=c}).catch(()=>{}))};return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(c){c&&(e=c.slice(0,128))},noteCamera(c){n=c},noteCameraTrack(c){a=c},async deviceHeader(){try{o??(o=be().catch(()=>""));let c=[];navigator.webdriver&&c.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&c.push("headless");let l=await o,m=ge(),Y={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(),...e?{cameraLabel:e}:{},...c.length?{signals:c}:{},...i?{print:{v:2,...i,...n?{camera:n}:{}}}:{},...y()?{inApp:!0}:{}},W=Te(JSON.stringify(Y));return s(),W}catch{return}},printReady(){return r??Promise.resolve()}}}var T=Symbol.for("sekyro.web.clientContext"),S=globalThis,w=S[T]??(S[T]=Se({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","simulated_capture_forbidden","native_app_required"];function L(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 K(t,e,n=Math.random){let o=(t??e)*1e3,i=Math.min(Math.max(o,500),2e4),r=Math.round(i*(1+(n()*2-1)*.25));return Math.min(Math.max(r,500),2e4)}var we=6e4,U=4,Pe=3e4,Ce=9e5,ke=200,Me=5,Ie=400,ve=new Set(["server_busy","request_timeout"]),Re=2;function p(t){return(t.split(";")[0]??"").trim()}var Ee={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},k=`@sekyro/web/${f}`,Ae=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=(o,i)=>(n??globalThis.fetch).call(globalThis,o,i),this.requestTimeoutMs=e.requestTimeoutMs??Pe,this.retryAttempts=e.inProgressRetry?.attempts??Me,this.retryDelayMs=e.inProgressRetry?.delayMs??Ie,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 testerGate(e){return this.api("POST","/hosted/tester-gate",{body:{input:e}})}async reportCaptureIssue(e){let n=typeof e.name=="string"?e.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",o=typeof e.engineKind=="string"&&/^[a-z_]{1,32}$/.test(e.engineKind)?e.engineKind:void 0,i=typeof e.attempt=="number"&&Number.isInteger(e.attempt)&&e.attempt>=0&&e.attempt<=1e3?e.attempt:void 0,r=[e.check,i??"",e.kind,n,e.phase??""].join("|"),a=this.reportedIssues.get(r);if(a!==void 0)return a;let d={check:e.check,kind:e.kind,...n!==""?{name:n}:{},...e.phase!==void 0?{phase:e.phase}:{},...o!==void 0?{engineKind:o}:{},...i!==void 0?{attempt:i}:{},...e.formFactor!==void 0?{formFactor:e.formFactor}:{},...typeof e.detail=="string"&&/^\d{1,10}$/.test(e.detail)?{detail:e.detail}:{},...B(e.challengeMs)?{challengeMs:e.challengeMs}:{},...B(e.readyMs)?{readyMs:e.readyMs}:{},...e.inApp===!0?{inApp:!0}:{}},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 o=await this.api("POST","/hosted/choice",{body:{nodeId:e,option:n},busyRetry:!0});return this.sessionId=o.sessionId,o}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,o,i={}){let r=await this.ensureSessionId(),a={kind:e,contentType:p(n),contentLength:o,...i.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${r}/media`,{body:a})}armCapture(e=2){this.fillCaptureNonces(e)}async presignCapture(e,n,o,i={}){let r=await this.ensureSessionId(),a=await this.takeCaptureNonce(),d=a===void 0?void 0:{nonce:a,...i.engine!==void 0?{engine:i.engine.slice(0,32)}:{},...i.durationMs!==void 0&&Number.isFinite(i.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(i.durationMs)))}:{}},s={kind:e,contentType:p(n),contentLength:o,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(o=>o.expiresAt-we>n),this.captureNonces.shift()?.nonce};for(let n=0;n<2;n++){let o=e();if(o!==void 0)return o;await this.fillCaptureNonces(1)}return e()}fillCaptureNonces(e){return this.captureFetch??(this.captureFetch=(async()=>{try{let n=await this.ensureSessionId(),o=await this.api("POST",`/sessions/${n}/media/capture-nonces`,{body:{count:Math.min(U,Math.max(1,e))}}),i=Date.now()+Math.max(0,o.expiresIn)*1e3;for(let r of Array.isArray(o.nonces)?o.nonces:[])typeof r=="string"&&r.length>0&&this.captureNonces.push({nonce:r,expiresAt:i});this.captureNonces=this.captureNonces.slice(-U)}catch{}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,n,o){let i;try{i=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":p(o)},body:n,signal:AbortSignal.timeout(Ce)})}catch(r){throw C(r)}if(!i.ok){let r=(await i.text().catch(()=>"")).slice(0,ke);throw new u({status:i.status,code:"upload_failed",message:`media upload failed (HTTP ${i.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,o={}){let i=await this.ensureSessionId(),r={input:n,forceOutcome:o.forceOutcome};return this.api("POST",`/sessions/${i}/checks/${e}`,{body:r,idempotencyKey:o.idempotencyKey,busyRetry:o.idempotencyKey!==void 0})}async uploadAndSubmit(e,n,o,i={}){let r=p(n.contentType),a=await this.presign(n.kind,r,n.blob.size);await this.uploadToSpaces(a.uploadUrl,n.blob,r);let d=await this.completeMedia(a.key),s={...o,[Ee[e]]:d.key};return this.submitCheck(e,s,i)}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,o={}){let i=e==="GET"||o.busyRetry===!0,r=`${this.apiOrigin}/api/v2${n}`,a={"x-session-token":this.sessionToken,"x-sekyro-sdk":Ae};o.body!==void 0&&(a["content-type"]="application/json"),o.idempotencyKey!==void 0&&(a["x-idempotency-key"]=o.idempotencyKey);try{let d=w.timezone();d!==void 0&&(a["sekyro-client-timezone"]=d)}catch{}a["sekyro-client-form-factor"]=I();try{let d=await w.deviceHeader();d!==void 0&&(a["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let s;try{s=await this.fetchImpl(r,{method:e,headers:a,...o.body!==void 0?{body:JSON.stringify(o.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw C(l)}if(s.ok){if(o.empty===!0)return;if(o.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 xe(l)}let c=await Oe(s);if(c.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await q(this.retryDelayMs);continue}if(i&&c.status===503&&ve.has(c.code)){i=!1,await q(K(c.retryAfterSeconds,Re,this.random));continue}throw c}}};function B(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0&&t<=6e5}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 xe(t){return t!==null&&typeof t=="object"&&"success"in t&&"data"in t?t.data:t}async function Oe(t){let e="unknown_error",n=`request failed (HTTP ${t.status})`,o=Number.NaN,i;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"&&(o=s.retryAfterSeconds),Array.isArray(s.details?.issues)?i=s.details:Array.isArray(s.details?.errors)&&(i={...s.details,issues:[]})}}catch{}let r=t.headers.get("retry-after"),a=r===null?Math.floor(o):Number.parseInt(r,10);return new u({status:t.status,code:e,message:n,...Number.isFinite(a)&&a>=0?{retryAfterSeconds:a}:{},details:i})}function q(t){return new Promise(e=>setTimeout(e,t))}function $(t){let e=t?.portrait,n=e?.icao,o=e?.purpose==="id_document";return n==null?o?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:o||n.profile==="id_document"?"id_document":"selfie"}}function G(t){return{...t.baselineEyeOpenness!==void 0?{baselineEyeOpenness:t.baselineEyeOpenness}:{},...t.baselineEyeOpennessLeft!==void 0&&t.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:t.baselineEyeOpennessLeft,baselineEyeOpennessRight:t.baselineEyeOpennessRight}:{},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-xyWB7dz2.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-BWu1JLgi.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 ClosedBy, j as CompleteMediaResult, k as ConsentLocale, l as ContactChannel, D as DecisionReason, m as DocDeviceRead, n as DocOcrInput, o as DocReason, p as DocSide, E as EidAfterPass, q as EidAuthInput, r as EidReason, s as EmailOtpInput, t as EmailOtpReason, F as FaceMatchInput, u as FaceMatchReason, v as FormAddressValue, w as FormAnswerValue, x as FormChoiceView, y as FormConsentView, z as FormCustomQuestionView, B as FormFieldName, G as FormFieldQuestionView, H as FormInput, I as FormIssueCode, J as FormLocale, K as FormQuestionOptions, L as FormQuestionType, M as FormQuestionView, N as HostedAcceptedDocuments, O as HostedCaptureTuning, P as HostedChallengeView, Q as HostedConsentView, R as HostedDocumentCaptureTuning, S as HostedDocumentScanTuning, T as HostedDocumentsView, U as HostedEidView, V as HostedEmailOtpView, W as HostedFlowRef, X as HostedFormView, Y as HostedIcaoPolicy, Z as HostedIntegrity, _ as HostedLivePhotoTuning, $ as HostedNativeAppView, a0 as HostedNativeCaptureTuning, a1 as HostedOcrTuning, a2 as HostedOtpView, a3 as HostedPlanView, a4 as HostedPoaRuleKindView, a5 as HostedPoaRuleView, a6 as HostedPortraitPendingFix, a7 as HostedPortraitView, a8 as HostedProofOfAddressView, a9 as HostedSessionView, aa as HostedSimulationView, ab as HostedStepView, ac as HostedTesterGateView, ad as HostedVoiceLocale, ae as HostedVoiceView, af as IcaoCriterion, ag as IcaoReportEntry, ah as IdentityConfirmDecision, ai as IdentityMethod, aj as IdentitySummarySource, ak as IdentitySummaryView, al as LivenessCaptureInput, am as LivenessInput, an as LivenessReason, ao as MatchReason, ap as MediaKind, aq as MethodChoiceView, ar as NationalEidOption, as as NfcChipReason, at as NfcStepView, au as OtpChoiceView, av as PhoneCountryRule, aw as PhoneFormat, ax as PhoneOtpInput, ay as PhoneOtpReason, az as PhotoSource, aA as PhotoSourcePick, aB as PlanAttempts, aC as PlanChoiceKind, aD as PlanChoiceOption, aE as PlanChoiceView, aF as PlanSectionView, aG as PlanStepView, aH as PoaImagesInput, aI as PoaInput, aJ as PoaKind, aK as PoaLicenceInput, aL as PoaNameMatchMode, aM as PoaPdfInput, aN as PoaReason, aO as PoaRuleSource, aP as PopulationInput, aQ as PopulationReason, aR as PortraitFix, aS as PortraitFixReviewInput, aT as PortraitIcaoInput, aU as PortraitIcaoReason, aV as PortraitOutputFormat, aW as PresignRequest, aX as PresignUploadResult, aY as RecordConsentResult, aZ as ResolvedCaptureMode, a_ as SandboxSimulatedReason, a$ as SandboxSimulation, b0 as SessionDecidingStep, b1 as SessionFailureReason, b2 as SessionReason, b3 as SessionStatus, b4 as SessionStepView, b5 as SessionView, b6 as SimulatedCaptureInput, b7 as StepResult, b8 as StepSection, b9 as SubmitCheckBody, ba as TesterGateInput, bb as TesterGateResponse, bc as VerificationAssurance, bd as VerificationLevel } from '../types-CezFEXzl.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-DveU9Cr8.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-OOEQDG9_.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 ClosedBy, j as CompleteMediaResult, k as ConsentLocale, l as ContactChannel, D as DecisionReason, m as DocDeviceRead, n as DocOcrInput, o as DocReason, p as DocSide, E as EidAfterPass, q as EidAuthInput, r as EidReason, s as EmailOtpInput, t as EmailOtpReason, F as FaceMatchInput, u as FaceMatchReason, v as FormAddressValue, w as FormAnswerValue, x as FormChoiceView, y as FormConsentView, z as FormCustomQuestionView, B as FormFieldName, G as FormFieldQuestionView, H as FormInput, I as FormIssueCode, J as FormLocale, K as FormQuestionOptions, L as FormQuestionType, M as FormQuestionView, N as HostedAcceptedDocuments, O as HostedCaptureTuning, P as HostedChallengeView, Q as HostedConsentView, R as HostedDocumentCaptureTuning, S as HostedDocumentScanTuning, T as HostedDocumentsView, U as HostedEidView, V as HostedEmailOtpView, W as HostedFlowRef, X as HostedFormView, Y as HostedIcaoPolicy, Z as HostedIntegrity, _ as HostedLivePhotoTuning, $ as HostedNativeAppView, a0 as HostedNativeCaptureTuning, a1 as HostedOcrTuning, a2 as HostedOtpView, a3 as HostedPlanView, a4 as HostedPoaRuleKindView, a5 as HostedPoaRuleView, a6 as HostedPortraitPendingFix, a7 as HostedPortraitView, a8 as HostedProofOfAddressView, a9 as HostedSessionView, aa as HostedSimulationView, ab as HostedStepView, ac as HostedTesterGateView, ad as HostedVoiceLocale, ae as HostedVoiceView, af as IcaoCriterion, ag as IcaoReportEntry, ah as IdentityConfirmDecision, ai as IdentityMethod, aj as IdentitySummarySource, ak as IdentitySummaryView, al as LivenessCaptureInput, am as LivenessInput, an as LivenessReason, ao as MatchReason, ap as MediaKind, aq as MethodChoiceView, ar as NationalEidOption, as as NfcChipReason, at as NfcStepView, au as OtpChoiceView, av as PhoneCountryRule, aw as PhoneFormat, ax as PhoneOtpInput, ay as PhoneOtpReason, az as PhotoSource, aA as PhotoSourcePick, aB as PlanAttempts, aC as PlanChoiceKind, aD as PlanChoiceOption, aE as PlanChoiceView, aF as PlanSectionView, aG as PlanStepView, aH as PoaImagesInput, aI as PoaInput, aJ as PoaKind, aK as PoaLicenceInput, aL as PoaNameMatchMode, aM as PoaPdfInput, aN as PoaReason, aO as PoaRuleSource, aP as PopulationInput, aQ as PopulationReason, aR as PortraitFix, aS as PortraitFixReviewInput, aT as PortraitIcaoInput, aU as PortraitIcaoReason, aV as PortraitOutputFormat, aW as PresignRequest, aX as PresignUploadResult, aY as RecordConsentResult, aZ as ResolvedCaptureMode, a_ as SandboxSimulatedReason, a$ as SandboxSimulation, b0 as SessionDecidingStep, b1 as SessionFailureReason, b2 as SessionReason, b3 as SessionStatus, b4 as SessionStepView, b5 as SessionView, b6 as SimulatedCaptureInput, b7 as StepResult, b8 as StepSection, b9 as SubmitCheckBody, ba as TesterGateInput, bb as TesterGateResponse, bc as VerificationAssurance, bd as VerificationLevel } from '../types-CezFEXzl.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 o,b as t,c as i,e as n,f as s,g as a,h as r,i as p}from"../chunk-ODI4A5K4.js";import"../chunk-TSA6GHUG.js";import{b as e}from"../chunk-A7QFTU6M.js";export{i as HostedApiError,a as HostedClient,o as KNOWN_CODES,s as SEKYRO_SDK_HEADER,r as icaoPolicyOf,e as isInAppBrowser,t as isKnownCode,p as portraitIcaoGate,n as stripMimeParams};
@@ -0,0 +1 @@
1
+ async function j(t){try{return O(await B(t))}catch{return null}}async function B(t){return typeof t.arrayBuffer=="function"?new Uint8Array(await t.arrayBuffer()):new Promise((r,a)=>{let e=new FileReader;e.onload=()=>r(new Uint8Array(e.result)),e.onerror=()=>a(e.error),e.readAsArrayBuffer(t)})}function O(t){if(t.length<8)return null;try{if(t[0]===26&&t[1]===69&&t[2]===223&&t[3]===163)return H(t);if(A(t,4,4)==="ftyp")return L(t)}catch{return null}return null}var R=new Set(["moov","trak","mdia","minf","stbl","mvex","moof","traf","edts"]);function L(t){let r=new DataView(t.buffer,t.byteOffset,t.byteLength),a=[],e=null,n=null,s=0,d=(l,f)=>{let o=l;for(;o+8<=f;){let m=r.getUint32(o),h=A(t,o+4,4),U=8;if(m===1){if(o+16>f)return;m=Number(r.getBigUint64(o+8)),U=16}else m===0&&(m=f-o);if(m<U)return;let x=Math.min(o+m,f),i=o+U;if(h==="trak"&&(e={id:0,video:!1,timescale:0,frames:0,units:0,defaultDuration:0},a.push(e)),h==="traf"&&(n=null,s=0),R.has(h))d(i,x);else if(h==="tkhd"&&e)e.id=r.getUint32(i+(t[i]===1?20:12));else if(h==="hdlr"&&e)e.video=A(t,i+8,4)==="vide";else if(h==="mdhd"&&e)e.timescale=r.getUint32(i+(t[i]===1?20:12));else if(h==="stts"&&e){let u=r.getUint32(i+4);for(let g=0;g<u;g++){let y=r.getUint32(i+8+g*8);e.frames+=y,e.units+=y*r.getUint32(i+12+g*8)}}else if(h==="trex"){let u=a.find(g=>g.id===r.getUint32(i+4));u&&(u.defaultDuration=r.getUint32(i+12))}else if(h==="tfhd"){let u=r.getUint32(i)&16777215;n=a.find(y=>y.id===r.getUint32(i+4))??null;let g=i+8;u&1&&(g+=8),u&2&&(g+=4),s=u&8?r.getUint32(g):n?.defaultDuration??0}else if(h==="trun"&&n){let u=r.getUint32(i)&16777215,g=r.getUint32(i+4),y=i+8;u&1&&(y+=4),u&4&&(y+=4);let D=(u&256?4:0)+(u&512?4:0)+(u&1024?4:0)+(u&2048?4:0);for(let b=0;b<g;b++)n.units+=u&256?r.getUint32(y+b*D):s;n.frames+=g}o=x}};d(0,t.length);let c=a.find(l=>l.video&&l.timescale>0);return!c||c.frames===0?null:{container:"mp4",frames:c.frames,durationMs:z(c.units*1e3/c.timescale)}}var E=408125543,M=357149030,N=374648427,C=174,T=524531317,I=160,w=2807729,S=17545,K=215,P=131,F=231,V=163,G=161,W=290298740,v=new Set([E,M,N,C,T,I]);function Y(t,r){let a=t[r];if(a===void 0||a===0)return null;let e=Math.clz32(a)-23;if(e<1||e>4||r+e>t.length)return null;let n=0;for(let s=0;s<e;s++)n=n*256+t[r+s];return[n,e]}function _(t,r){let a=t[r];if(a===void 0||a===0)return null;let e=Math.clz32(a)-23;if(e<1||e>8||r+e>t.length)return null;let n=a&255>>e,s=n===255>>e;for(let d=1;d<e;d++){let c=t[r+d];n=n*256+c,c!==255&&(s=!1)}return[s?-1:n,e]}function p(t,r,a){let e=0;for(let n=0;n<a;n++)e=e*256+t[r+n];return e}function k(t){let r=[],a=0;for(;a<t.length;){let e=Y(t,a);if(!e)break;let n=_(t,a+e[1]);if(!n)break;let s={id:e[0],start:a,sizeAt:a+e[1],data:a+e[1]+n[1],size:n[0]};if(r.push(s),v.has(s.id))a=s.data;else{if(s.size<0)break;a=s.data+s.size}}return r}function H(t){let r=new DataView(t.buffer,t.byteOffset,t.byteLength),a=1e6,e=[],n=0,s=[];for(let l of k(t)){if(l.data+Math.max(0,l.size)>t.length&&!v.has(l.id))break;switch(l.id){case w:a=p(t,l.data,l.size)||a;break;case C:e.push({num:0,type:0});break;case K:e.length&&(e[e.length-1].num=p(t,l.data,l.size));break;case P:e.length&&(e[e.length-1].type=p(t,l.data,l.size));break;case F:n=p(t,l.data,l.size);break;case V:case G:{let f=_(t,l.data);if(!f||l.data+f[1]+2>t.length)break;let o=e.filter(m=>m.type===1).map(m=>m.num);if(o.length>0&&!o.includes(f[0]))break;s.push((n+r.getInt16(l.data+f[1]))*a/1e6);break}default:break}}if(s.length===0)return null;s.sort((l,f)=>l-f);let d=s.slice(1).map((l,f)=>l-s[f]),c=d.length?d.sort((l,f)=>l-f)[Math.floor(d.length/2)]:0;return{container:"webm",frames:s.length,durationMs:z(s[s.length-1]-s[0]+c)}}function q(t,r){if(!(r>0))return null;let a=k(t),e=a.find(i=>i.id===E);if(!e||e.size!==-1||a.some(i=>i.id===W))return null;let n=a.find(i=>i.id===M);if(!n||n.size<0||n.data+n.size>t.length)return null;let s=1e6,d=[];for(let i of a)i.start<n.data||i.start>=n.data+n.size||(i.id===w&&(s=p(t,i.data,i.size)||s),i.id!==S&&d.push(t.subarray(i.start,i.data+i.size)));let c=new Uint8Array(11);c.set([68,137,136]),new DataView(c.buffer).setFloat64(3,r*1e6/s);let l=d.reduce((i,u)=>i+u.length,0)+c.length,f=new Uint8Array(12);f.set([21,73,169,102,1]);let o=l;for(let i=11;i>=5;i--)f[i]=o&255,o=Math.floor(o/256);let m=t.subarray(n.data+n.size),h=new Uint8Array(n.start+f.length+l+m.length),U=0,x=i=>{h.set(i,U),U+=i.length};return x(t.subarray(0,n.start)),x(f),d.forEach(x),x(c),x(m),h}function J(t){let r=1e6,a=null,e=new DataView(t.buffer,t.byteOffset,t.byteLength);for(let n of k(t))if(n.id===w&&(r=p(t,n.data,n.size)||r),n.id===S&&(a=n.size===8?e.getFloat64(n.data):n.size===4?e.getFloat32(n.data):null),n.id===T)break;return a===null?null:z(a*r/1e6)}function A(t,r,a){let e="";for(let n=0;n<a&&r+n<t.length;n++)e+=String.fromCharCode(t[r+n]);return e}function z(t){return Math.round(t*10)/10}export{B as blobBytes,j as inspectClip,O as inspectClipBytes,J as webmDurationMs,q as withWebmDuration};