@sekyro/web 0.1.0-rc.3 → 0.1.0-rc.31
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.
- package/CHANGELOG.md +433 -0
- package/LICENSE +25 -16
- package/README.md +157 -62
- package/THIRD-PARTY-NOTICES.txt +154 -0
- package/dist/background-monitor-A7FKJOAG.js +1 -0
- package/dist/barcode-detect-C5IOXMKI.js +1 -0
- package/dist/camera-trait-V4UAOPIQ.js +1 -0
- package/dist/capture-constraints-CVqpMNGA.d.cts +48 -0
- package/dist/capture-constraints-CVqpMNGA.d.ts +48 -0
- package/dist/capture-session-doc-2LIRRKFX.js +1 -0
- package/dist/{capture-session-v3-COIO_F2w.d.cts → capture-session-v3-Fbj-X2Ij.d.ts} +259 -13
- package/dist/{capture-session-v3-CvIfcwST.d.ts → capture-session-v3-XtBrXpoW.d.cts} +259 -13
- package/dist/challenge-frame-YAQJ5YMB.js +1 -0
- package/dist/chunk-2LDOXGY3.js +1 -0
- package/dist/chunk-2MX4J26D.js +3 -0
- package/dist/chunk-33KKMPJ5.js +1 -0
- package/dist/chunk-3K3A7O7J.js +1 -0
- package/dist/chunk-53POX7U4.js +1 -0
- package/dist/chunk-6ERQTXMY.js +1 -0
- package/dist/chunk-6Z4MIKGF.js +1 -0
- package/dist/chunk-7QZWBDI5.js +1 -0
- package/dist/chunk-CJHMFPL6.js +1 -0
- package/dist/chunk-CMXN4SOZ.js +1 -0
- package/dist/chunk-CPUECYAJ.js +1 -0
- package/dist/chunk-DFTCAWMP.js +1 -0
- package/dist/chunk-DK5YPBDQ.js +1 -0
- package/dist/chunk-FPXL63KZ.js +1 -0
- package/dist/chunk-FSSMUAKC.js +1 -0
- package/dist/chunk-G6LKLN4U.js +1 -0
- package/dist/chunk-GFJATPUR.js +1 -0
- package/dist/chunk-GI3UFGRQ.js +1 -0
- package/dist/chunk-GXL6ZD4I.js +1 -0
- package/dist/chunk-JLVZ35QK.js +2 -0
- package/dist/chunk-MD4YXLPK.js +1 -0
- package/dist/chunk-OUC57KMS.js +1 -0
- package/dist/chunk-POIQGEZM.js +1 -0
- package/dist/chunk-R3JMNYW5.js +1 -0
- package/dist/chunk-RI3E7GBN.js +1 -0
- package/dist/chunk-SMKCBUJL.js +1 -0
- package/dist/chunk-SUANHBF4.js +1 -0
- package/dist/chunk-SX7TUC3V.js +1 -0
- package/dist/chunk-TN4JWBFJ.js +1 -0
- package/dist/chunk-TSA6GHUG.js +1 -0
- package/dist/chunk-VWGKUQ3C.js +1 -0
- package/dist/chunk-XFDWFJLY.js +1 -0
- package/dist/chunk-ZKF2XMNX.js +1 -0
- package/dist/client/index.cjs +1 -357
- package/dist/client/index.d.cts +6 -37
- package/dist/client/index.d.ts +6 -37
- package/dist/client/index.js +1 -15
- package/dist/clip-inspect-DLJXVKV6.js +1 -0
- package/dist/core/index.cjs +1 -1606
- package/dist/core/index.d.cts +5 -4
- package/dist/core/index.d.ts +5 -4
- package/dist/core/index.js +1 -139
- package/dist/core/ocr/worker.bundle.js +42 -0
- package/dist/core/ocr/worker.cjs +42 -0
- package/dist/core/ocr/worker.d.cts +84 -0
- package/dist/core/ocr/worker.d.ts +84 -0
- package/dist/core/ocr/worker.js +41 -0
- package/dist/core/v3/detect-worker.cjs +1 -392
- package/dist/core/v3/detect-worker.d.cts +1 -1
- package/dist/core/v3/detect-worker.d.ts +1 -1
- package/dist/core/v3/detect-worker.js +1 -13
- package/dist/create-document-capture-X35M4UAK.js +1 -0
- package/dist/create-portrait-capture-5VGYZUOK.js +1 -0
- package/dist/create-verification-RdG6qv51.d.ts +3732 -0
- package/dist/create-verification-lXGU3ac4.d.cts +3732 -0
- package/dist/{detect-worker-CKXHlXx9.d.ts → detect-worker-CHqsPJoM.d.cts} +25 -2
- package/dist/{detect-worker-CKXHlXx9.d.cts → detect-worker-CHqsPJoM.d.ts} +25 -2
- package/dist/detector-scanic-KMAVOHGF.js +1 -0
- package/dist/icao-gate-Cp1C4IEZ.d.ts +578 -0
- package/dist/icao-gate-DVNkPclI.d.cts +578 -0
- package/dist/icao-gate-T3BTOKFJ.js +1 -0
- package/dist/icao-policy-CcrwfsVr.d.ts +80 -0
- package/dist/icao-policy-c2Ykm9r2.d.cts +80 -0
- package/dist/icao-tuning-4ETMF53W.js +1 -0
- package/dist/index.cjs +3 -2649
- package/dist/index.d.cts +138 -5
- package/dist/index.d.ts +138 -5
- package/dist/index.js +1 -28
- package/dist/internal/index.cjs +3 -4179
- package/dist/internal/index.d.cts +390 -371
- package/dist/internal/index.d.ts +390 -371
- package/dist/internal/index.js +1 -647
- package/dist/keyframe-rank-YAJLYJYF.js +1 -0
- package/dist/landmarker-KB7LVXAU.js +1 -0
- package/dist/mrz-band-VYHOTDHY.js +1 -0
- package/dist/plan-runner-T2ZTSBI4.js +1 -0
- package/dist/popup/index.cjs +1 -76
- package/dist/popup/index.d.cts +9 -3
- package/dist/popup/index.d.ts +9 -3
- package/dist/popup/index.js +1 -11
- package/dist/print-SEWS3VHQ.js +1 -0
- package/dist/scanic-ml-stub-KW7IZHUT.js +1 -0
- package/dist/segmenter-USLNBX65.js +1 -0
- package/dist/types-B47mZ5TT.d.cts +2107 -0
- package/dist/types-B47mZ5TT.d.ts +2107 -0
- package/dist/upload-file-EGXXM6TQ.js +1 -0
- package/package.json +30 -11
- package/sbom.cdx.json +349 -0
- package/dist/capture-constraints-BujkZcfb.d.cts +0 -21
- package/dist/capture-constraints-BujkZcfb.d.ts +0 -21
- package/dist/chunk-7TC6TOZ4.js +0 -1095
- package/dist/chunk-7TC6TOZ4.js.map +0 -1
- package/dist/chunk-FIXX2AXC.js +0 -864
- package/dist/chunk-FIXX2AXC.js.map +0 -1
- package/dist/chunk-MWNFSNMP.js +0 -52
- package/dist/chunk-MWNFSNMP.js.map +0 -1
- package/dist/chunk-NILNKLK6.js +0 -50
- package/dist/chunk-NILNKLK6.js.map +0 -1
- package/dist/chunk-NWF46H7K.js +0 -359
- package/dist/chunk-NWF46H7K.js.map +0 -1
- package/dist/chunk-WY6U7AIK.js +0 -193
- package/dist/chunk-WY6U7AIK.js.map +0 -1
- package/dist/chunk-YVFF4Q4G.js +0 -327
- package/dist/chunk-YVFF4Q4G.js.map +0 -1
- package/dist/client/index.cjs.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/v3/detect-worker.cjs.map +0 -1
- package/dist/core/v3/detect-worker.js.map +0 -1
- package/dist/create-verification-CP18eq1Q.d.cts +0 -348
- package/dist/create-verification-CswF2As-.d.ts +0 -348
- package/dist/detector-scanic-4C6IEW2K.js +0 -787
- package/dist/detector-scanic-4C6IEW2K.js.map +0 -1
- package/dist/hosted-client-BpvBqu9f.d.cts +0 -408
- package/dist/hosted-client-BpvBqu9f.d.ts +0 -408
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/internal/index.cjs.map +0 -1
- package/dist/internal/index.js.map +0 -1
- package/dist/popup/index.cjs.map +0 -1
- package/dist/popup/index.js.map +0 -1
- package/dist/scanic-ml-stub-S2OZ6HEF.js +0 -10
- package/dist/scanic-ml-stub-S2OZ6HEF.js.map +0 -1
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
import { a9 as HostedSessionView, k as ConsentLocale, Q as HostedConsentView, bg as CameraUnavailableCause, ba as TesterGateInput, bb as TesterGateResponse, bh as CaptureIssueReport, ah as IdentityConfirmDecision, ap as MediaKind, aX as PresignUploadResult, C as CaptureContext, j as CompleteMediaResult, h as CheckType, e as CheckInputByType, af as IcaoCriterion, bx as BackgroundUniformity, bu as ResolvedIcaoTuning } from './types-B47mZ5TT.cjs';
|
|
2
|
+
|
|
3
|
+
interface Point {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
interface Box {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}
|
|
13
|
+
/** The face geometry the gate needs, in SOURCE (stream) pixels. */
|
|
14
|
+
interface FaceGeometry {
|
|
15
|
+
/** Eye centres, ordered by image x (`left` = smaller x). */
|
|
16
|
+
leftEye: Point;
|
|
17
|
+
rightEye: Point;
|
|
18
|
+
/** Inter-ocular distance (px). */
|
|
19
|
+
iod: number;
|
|
20
|
+
/** Bounding box of the landmark mesh (forehead to chin). */
|
|
21
|
+
box: Box;
|
|
22
|
+
/** Nose tip (landmark 1): splits the face into halves for the lighting ratio. */
|
|
23
|
+
nose: Point;
|
|
24
|
+
/** Eye-contour boxes (glare), same order as the eyes. */
|
|
25
|
+
leftEyeBox: Box;
|
|
26
|
+
rightEyeBox: Box;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Normalised Face Landmarker landmarks (0..1) → source-pixel geometry.
|
|
30
|
+
* `null` when the mesh is too short to carry the eyes.
|
|
31
|
+
*/
|
|
32
|
+
declare function faceGeometry(landmarks: readonly Point[], width: number, height: number): FaceGeometry | null;
|
|
33
|
+
interface HeadPose {
|
|
34
|
+
yaw: number;
|
|
35
|
+
pitch: number;
|
|
36
|
+
roll: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Yaw / pitch / roll (degrees) of the Face Landmarker's facial transformation
|
|
40
|
+
* matrix (4×4, `layout` of `data`; MediaPipe emits column-major). Rotation
|
|
41
|
+
* order R = Rz(roll)·Ry(yaw)·Rx(pitch): yaw turns about the vertical axis,
|
|
42
|
+
* pitch nods, roll tilts. Only magnitudes are gated, so sign conventions never
|
|
43
|
+
* change a verdict. `null` for a malformed matrix.
|
|
44
|
+
*/
|
|
45
|
+
declare function poseFromMatrix(data: readonly number[], layout?: "column" | "row"): HeadPose | null;
|
|
46
|
+
/** Roll from the eye line (degrees) — the fallback when no matrix is available. */
|
|
47
|
+
declare function eyeLineRoll(g: Pick<FaceGeometry, "leftEye" | "rightEye">): number;
|
|
48
|
+
/** The ICAO canvas (icao.py): 480×640, eye midpoint at x = 240, eye line at y = 289, IOD 120–160. */
|
|
49
|
+
declare const ICAO_CANVAS: {
|
|
50
|
+
readonly width: 480;
|
|
51
|
+
readonly height: 640;
|
|
52
|
+
readonly eyeX: 240;
|
|
53
|
+
readonly eyeY: 289;
|
|
54
|
+
readonly iodMin: 120;
|
|
55
|
+
readonly iodMax: 160;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* The source-pixel window the server's ICAO crop is cut from: scale 1 when the
|
|
59
|
+
* IOD already lies in 120–160, else the scale that brings it to 120 (icao.py:
|
|
60
|
+
* "120 when outside the band"), the eye midpoint at (240, 289) of the window.
|
|
61
|
+
*/
|
|
62
|
+
declare function icaoWindow(g: Pick<FaceGeometry, "leftEye" | "rightEye" | "iod">): Box;
|
|
63
|
+
/** How far a window spills outside the frame (0 = inside), as a fraction of its size. */
|
|
64
|
+
declare function windowOverflow(window: Box, frameWidth: number, frameHeight: number): number;
|
|
65
|
+
/**
|
|
66
|
+
* The region of the full-resolution still the SDK uploads: the ICAO window
|
|
67
|
+
* grown by `margin` about its centre (so the server re-crops with its own
|
|
68
|
+
* landmarks), at least `minWidth × minHeight`, 3:4 portrait, then fitted into
|
|
69
|
+
* the frame — the margin shrinks first, then the box slides inside, and only
|
|
70
|
+
* a window larger than the frame is cut to it. Integer pixels.
|
|
71
|
+
*/
|
|
72
|
+
declare function portraitCropRegion(g: Pick<FaceGeometry, "leftEye" | "rightEye" | "iod">, frameWidth: number, frameHeight: number, opts: {
|
|
73
|
+
margin: number;
|
|
74
|
+
minWidth: number;
|
|
75
|
+
minHeight: number;
|
|
76
|
+
}): Box;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Strip MIME parameters: `video/webm;codecs=vp8,opus` → `video/webm`.
|
|
80
|
+
*
|
|
81
|
+
* The capture engine (Task 4) emits `clipMimeType` WITH codec parameters, but
|
|
82
|
+
* the presign allowlist holds BARE types only (['video/webm','video/mp4'] /
|
|
83
|
+
* ['image/jpeg','image/png']) and the presigned PUT signs the exact declared
|
|
84
|
+
* Content-Type. Exported so pages can normalize once and stay byte-consistent
|
|
85
|
+
* between presign and PUT.
|
|
86
|
+
*/
|
|
87
|
+
declare function stripMimeParams(contentType: string): string;
|
|
88
|
+
/** Media-bearing check types → the input field the promoted key goes into. */
|
|
89
|
+
declare const MEDIA_INPUT_FIELD: {
|
|
90
|
+
readonly liveness: "clipKey";
|
|
91
|
+
readonly face_match: "imageKey";
|
|
92
|
+
readonly doc_ocr: "imageKey";
|
|
93
|
+
};
|
|
94
|
+
/** Check types that take an uploaded media key (population_registry does not). */
|
|
95
|
+
type MediaCheckType = keyof typeof MEDIA_INPUT_FIELD;
|
|
96
|
+
interface SubmitOptions {
|
|
97
|
+
/**
|
|
98
|
+
* Sent as `x-idempotency-key` (the header IdempotencyInterceptor reads).
|
|
99
|
+
* One key per LOGICAL submit — a flaky-network retry with the same key
|
|
100
|
+
* replays the first response without burning another attempt.
|
|
101
|
+
*/
|
|
102
|
+
idempotencyKey?: string;
|
|
103
|
+
/**
|
|
104
|
+
* SANDBOX-ONLY deterministic override (plan D-C); a live session 403s it. The `age_*` values ride the liveness
|
|
105
|
+
* submit and pick what the age check (selfie) step decides.
|
|
106
|
+
*/
|
|
107
|
+
forceOutcome?: "pass" | "fail" | "age_over" | "age_uncertain" | "age_under" | "age_unavailable";
|
|
108
|
+
/**
|
|
109
|
+
* Browser check, one proof per session (2026-11-15): a token for a submission that is not the selfie video (the
|
|
110
|
+
* session's first one, a code send), sent as `sekyro-browser-check`. `createVerification` sets it.
|
|
111
|
+
*/
|
|
112
|
+
browserCheckToken?: string;
|
|
113
|
+
}
|
|
114
|
+
interface UploadMedia {
|
|
115
|
+
kind: MediaKind;
|
|
116
|
+
blob: Blob;
|
|
117
|
+
/** May carry codec params (engine `clipMimeType`) — stripped before presign AND PUT. */
|
|
118
|
+
contentType: string;
|
|
119
|
+
}
|
|
120
|
+
interface HostedClientOptions {
|
|
121
|
+
/** API origin, e.g. `https://api.sekyro.ai` — paths are `${apiOrigin}/api/v2/...`. */
|
|
122
|
+
apiOrigin: string;
|
|
123
|
+
/** The raw session token from the hosted URL (short code) — sent as `x-session-token` on every API call. */
|
|
124
|
+
sessionToken: string;
|
|
125
|
+
/** Injection seam (tests / non-window contexts). Defaults to `globalThis.fetch`. */
|
|
126
|
+
fetch?: typeof globalThis.fetch;
|
|
127
|
+
/** Per-request timeout for API calls (NOT the Spaces PUT). Default 30 000 ms. */
|
|
128
|
+
requestTimeoutMs?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Tuning for the automatic retry on 409 `idempotency_in_progress` (a
|
|
131
|
+
* concurrent identical request is mid-flight server-side; the real response
|
|
132
|
+
* lands once it finishes). `attempts` counts retries AFTER the first try.
|
|
133
|
+
* Defaults: 5 × 400 ms. (The other automatic retry, once on a 503
|
|
134
|
+
* `server_busy` / `request_timeout`, is not tunable.)
|
|
135
|
+
*/
|
|
136
|
+
inProgressRetry?: {
|
|
137
|
+
attempts?: number;
|
|
138
|
+
delayMs?: number;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Injection seam (tests): the source of the busy-retry jitter, returning a value in [0, 1).
|
|
142
|
+
* Defaults to `Math.random`.
|
|
143
|
+
*/
|
|
144
|
+
random?: () => number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Hand-authored typed client for the five session-token endpoints:
|
|
148
|
+
*
|
|
149
|
+
* GET /api/v2/hosted/session → {@link getSession}
|
|
150
|
+
* POST /api/v2/hosted/consent → {@link recordConsent}
|
|
151
|
+
* POST /api/v2/hosted/choice → {@link choose}
|
|
152
|
+
* POST /api/v2/hosted/identity/confirm → {@link confirmIdentity}
|
|
153
|
+
* GET /api/v2/hosted/identity/portrait → {@link identityPortrait}
|
|
154
|
+
* POST /api/v2/sessions/:id/media → {@link presign}
|
|
155
|
+
* POST /api/v2/sessions/:id/media/complete → {@link completeMedia}
|
|
156
|
+
* POST /api/v2/sessions/:id/checks/:checkType → {@link submitCheck}
|
|
157
|
+
*
|
|
158
|
+
* plus the bare presigned Spaces PUT ({@link uploadToSpaces}) and the
|
|
159
|
+
* presign→PUT→complete→submit composition ({@link uploadAndSubmit}).
|
|
160
|
+
*
|
|
161
|
+
* Envelopes (verified against sessions-docs.e2e-spec.ts):
|
|
162
|
+
* - success: `{success: true, data}` — unwrapped here, methods return the payload;
|
|
163
|
+
* - error: flat `{code, message}` → thrown as {@link HostedApiError}.
|
|
164
|
+
*
|
|
165
|
+
* The media/checks routes are `:id`-addressed while the token itself is the
|
|
166
|
+
* only credential the page starts with — the client learns its sessionId from
|
|
167
|
+
* `GET /hosted/session` (token-addressed) and lazily bootstraps it when a
|
|
168
|
+
* `:id` route is called first.
|
|
169
|
+
*
|
|
170
|
+
* Two automatic retries only: bounded short-delay retry on 409
|
|
171
|
+
* `idempotency_in_progress`, and ONE retry after `Retry-After` (capped at 20 s,
|
|
172
|
+
* ±25 % jitter) on a 503 `server_busy` / `request_timeout` for the calls that are safe to
|
|
173
|
+
* repeat: the reads (`getSession`, `identityPortrait`), the naturally
|
|
174
|
+
* idempotent writes (`recordConsent`, `choose`) and `submitCheck` with an
|
|
175
|
+
* idempotency key. Everything else — including 429 with its parsed
|
|
176
|
+
* `retryAfterSeconds` — is surfaced to the page to handle.
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* The `x-sekyro-sdk` value of this SDK (`@sekyro/web/<version>`, person data spec §5.6): every hosted
|
|
180
|
+
* call sends it. A page that calls a hosted session-token route itself sends it too.
|
|
181
|
+
*/
|
|
182
|
+
declare const SEKYRO_SDK_HEADER: string;
|
|
183
|
+
declare class HostedClient {
|
|
184
|
+
private readonly apiOrigin;
|
|
185
|
+
private readonly sessionToken;
|
|
186
|
+
private readonly fetchImpl;
|
|
187
|
+
private readonly requestTimeoutMs;
|
|
188
|
+
private readonly retryAttempts;
|
|
189
|
+
private readonly retryDelayMs;
|
|
190
|
+
private readonly random;
|
|
191
|
+
private sessionId;
|
|
192
|
+
private bootstrap;
|
|
193
|
+
/** D8: prefetched capture nonces (`armCapture`), each with its local expiry. */
|
|
194
|
+
private captureNonces;
|
|
195
|
+
private captureFetch;
|
|
196
|
+
/** Capture issues already reported, with their send (see reportCaptureIssue): a repeat awaits the first. */
|
|
197
|
+
private readonly reportedIssues;
|
|
198
|
+
constructor(opts: HostedClientOptions);
|
|
199
|
+
/** Token-addressed bootstrap — the hosted page's first call. Caches the sessionId. */
|
|
200
|
+
getSession(): Promise<HostedSessionView>;
|
|
201
|
+
/**
|
|
202
|
+
* Record consent once (201; an idempotent replay answers 200 with
|
|
203
|
+
* `alreadyRecorded: true`). Until recorded, media presign/complete AND check
|
|
204
|
+
* submission answer 409 `consent_required`.
|
|
205
|
+
*/
|
|
206
|
+
recordConsent(locale: ConsentLocale): Promise<HostedConsentView>;
|
|
207
|
+
/**
|
|
208
|
+
* Spec 2026-10-29 §3.4: the device has no usable camera. The server fails the frontier liveness step with
|
|
209
|
+
* `camera_unavailable` (no attempt, nothing billed) and lets the flow decide: a fallback step, else the session
|
|
210
|
+
* ends at level 0. Returns the hosted view; 409 `check_out_of_order` when the frontier is not a liveness step.
|
|
211
|
+
* `cause` (2026-10-30) says why (`denied` | `no_camera`); omitted, the body stays `{}` and nothing is recorded.
|
|
212
|
+
*/
|
|
213
|
+
reportCameraUnavailable(cause?: CameraUnavailableCause): Promise<HostedSessionView>;
|
|
214
|
+
/**
|
|
215
|
+
* Spec 2026-11-09 §3.3: "Run real checks as a tester". The body is the liveness clip of the gate (the liveness step's
|
|
216
|
+
* input shape). The server runs the real liveness model and compares the face with the organization's enrolled
|
|
217
|
+
* testers; the answer is the hosted view plus `bound`. Refusals: `403 sandbox_only`, `409 session_already_bound`,
|
|
218
|
+
* `409 tester_gate_closed`, `409 gate_attempts_exhausted`, `429 tester_limit_reached`, `503 inference_unavailable`.
|
|
219
|
+
*/
|
|
220
|
+
testerGate(input: TesterGateInput): Promise<TesterGateResponse>;
|
|
221
|
+
/**
|
|
222
|
+
* 2026-11-04: record a capture failure the page showed (`POST /hosted/capture-issue`, 204) so it can be diagnosed
|
|
223
|
+
* later. Fire-and-forget: never rejects, and every failure is swallowed. At most one report per distinct
|
|
224
|
+
* (check, attempt, kind, name, phase); a repeat makes no call and resolves when the first send settles (a failed send
|
|
225
|
+
* is forgotten, so a later repeat sends again). `name` is re-sanitised (letters only, at most
|
|
226
|
+
* 40 characters) and `engineKind` kept only when it is a lower-case code of at most 32 characters.
|
|
227
|
+
*/
|
|
228
|
+
reportCaptureIssue(issue: CaptureIssueReport): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Pick an option of the current choice (Sekyro flows §7.4): `plan.choice`'s
|
|
231
|
+
* `nodeId` and one of its option ids. Returns the updated hosted view —
|
|
232
|
+
* render it. The person may switch while `plan.choice.locked` is false.
|
|
233
|
+
* Errors: 409 `choice_locked`, 409 `choice_option_unavailable`, 404 `choice_not_found`.
|
|
234
|
+
*/
|
|
235
|
+
choose(nodeId: string, option: string): Promise<HostedSessionView>;
|
|
236
|
+
/**
|
|
237
|
+
* Answer the identity summary (`identitySummary` in the view, Step 2b):
|
|
238
|
+
* `confirm` lifts the live-photo gate, `retake` re-opens the identity checks
|
|
239
|
+
* that produced the data. Returns the updated hosted view; 409
|
|
240
|
+
* `identity_confirm_locked` when nothing is pending or no retake is left.
|
|
241
|
+
*/
|
|
242
|
+
confirmIdentity(decision: IdentityConfirmDecision): Promise<HostedSessionView>;
|
|
243
|
+
/**
|
|
244
|
+
* The summary portrait (`identitySummary.portrait.available`) as a JPEG
|
|
245
|
+
* `Blob`, fetched with the session-token header (`Cache-Control: no-store`).
|
|
246
|
+
* Show it from memory (`URL.createObjectURL`, revoked when done) — never
|
|
247
|
+
* cache or store it.
|
|
248
|
+
*/
|
|
249
|
+
identityPortrait(): Promise<Blob>;
|
|
250
|
+
/**
|
|
251
|
+
* Presign a Spaces PUT for a new pending object. `contentType` is stripped of
|
|
252
|
+
* MIME parameters defensively (the allowlist holds bare types; the engine's
|
|
253
|
+
* `clipMimeType` carries codec params) — PUT with the SAME bare type, or the
|
|
254
|
+
* signed-header check rejects the upload.
|
|
255
|
+
*/
|
|
256
|
+
presign(kind: MediaKind, contentType: string, contentLength: number, options?: {
|
|
257
|
+
source?: "upload";
|
|
258
|
+
}): Promise<PresignUploadResult>;
|
|
259
|
+
/**
|
|
260
|
+
* D8: prefetch live-camera capture nonces when a camera capture STARTS, so the
|
|
261
|
+
* presigns that follow (`presignCapture`) need no extra round trip. Never
|
|
262
|
+
* throws; an older backend without the route simply leaves the pool empty.
|
|
263
|
+
*/
|
|
264
|
+
armCapture(count?: number): void;
|
|
265
|
+
/**
|
|
266
|
+
* D8: presign a LIVE-CAMERA image / clip — like {@link presign}, plus the
|
|
267
|
+
* capture proof: a fresh single-use nonce (pooled by {@link armCapture}, else
|
|
268
|
+
* fetched now), the engine and the capture duration. When no nonce can be had
|
|
269
|
+
* (route absent, network) the presign goes out without a proof — the backend
|
|
270
|
+
* decides (`signal` flags it, `enforce` refuses it). Only the SDK's own capture
|
|
271
|
+
* flows call this; a picked file goes through {@link presign}.
|
|
272
|
+
*/
|
|
273
|
+
presignCapture(kind: MediaKind, contentType: string, contentLength: number, context?: CaptureContext): Promise<PresignUploadResult>;
|
|
274
|
+
/** D8: one pooled (still fresh) nonce, else one fetched now; undefined when none can be had. */
|
|
275
|
+
private takeCaptureNonce;
|
|
276
|
+
/** D8: fetch `count` nonces into the pool (one request in flight at a time). Never throws. */
|
|
277
|
+
private fillCaptureNonces;
|
|
278
|
+
/**
|
|
279
|
+
* Bare PUT to the presigned Spaces URL: EXACTLY the signed headers — the
|
|
280
|
+
* declared Content-Type and the blob body. NO `x-session-token` (the
|
|
281
|
+
* signature IS the credential; an extra header breaks nothing but leaks the
|
|
282
|
+
* token to a third-party host) and no JSON envelope.
|
|
283
|
+
*
|
|
284
|
+
* `contentType` is param-stripped here too (idempotent for bare types): the
|
|
285
|
+
* presign strips internally, so a caller composing manually with the engine's
|
|
286
|
+
* parameterful `clipMimeType` would otherwise sign `video/webm` but PUT
|
|
287
|
+
* `video/webm;codecs=…` — a signed-header mismatch S3 rejects at runtime.
|
|
288
|
+
*
|
|
289
|
+
* Timeout: 15 min (`AbortSignal.timeout(900_000)`, matching the presign TTL)
|
|
290
|
+
* rather than the API calls' 30 s — a 15 MB clip on a slow link legitimately
|
|
291
|
+
* exceeds 30 s, but a stalled in-flight socket must still be bounded (the TTL
|
|
292
|
+
* alone only bounds when a PUT can START).
|
|
293
|
+
*
|
|
294
|
+
* Failures are ALWAYS typed: non-2xx throws {@link HostedApiError} with the
|
|
295
|
+
* client-synthesized `upload_failed` (message carries a truncated S3 body
|
|
296
|
+
* snippet — e.g. SignatureDoesNotMatch); a mid-transfer drop → `network_error`;
|
|
297
|
+
* the timeout → `timeout`.
|
|
298
|
+
*/
|
|
299
|
+
uploadToSpaces(uploadUrl: string, blob: Blob, contentType: string): Promise<void>;
|
|
300
|
+
/** Finalize an upload: the backend sniffs + promotes; returns the PROMOTED key to submit. */
|
|
301
|
+
completeMedia(key: string): Promise<CompleteMediaResult>;
|
|
302
|
+
/**
|
|
303
|
+
* Submit one check. Sends `{input, forceOutcome?}` (SubmitCheckSchema) and the
|
|
304
|
+
* optional `x-idempotency-key` header. Returns the hosted view after the
|
|
305
|
+
* submission (Sekyro flows §8.2: with its `plan`) — render it.
|
|
306
|
+
*/
|
|
307
|
+
submitCheck<T extends CheckType>(checkType: T, input: CheckInputByType[T], opts?: SubmitOptions): Promise<HostedSessionView>;
|
|
308
|
+
/**
|
|
309
|
+
* Convenience composition: presign → PUT → complete → submit, passing the
|
|
310
|
+
* PROMOTED key (from complete's response — never the pending presign key)
|
|
311
|
+
* into the check's media input field (`clipKey` for liveness, `imageKey` for
|
|
312
|
+
* face_match/doc_ocr). `extraInput` carries the remaining input fields
|
|
313
|
+
* (liveness `attestation`, doc_ocr `side`). The media content type is
|
|
314
|
+
* param-stripped ONCE and used for both presign and PUT, so the signed
|
|
315
|
+
* header always matches.
|
|
316
|
+
*/
|
|
317
|
+
uploadAndSubmit<T extends MediaCheckType>(checkType: T, media: UploadMedia, extraInput: Omit<CheckInputByType[T], (typeof MEDIA_INPUT_FIELD)[T]>, opts?: SubmitOptions): Promise<HostedSessionView>;
|
|
318
|
+
/** The token's own sessionId — cached from getSession(), lazily bootstrapped. */
|
|
319
|
+
private ensureSessionId;
|
|
320
|
+
/**
|
|
321
|
+
* One API request: `${apiOrigin}/api/v2${path}`, `x-session-token` always,
|
|
322
|
+
* AbortSignal timeout (30 s default), `{success, data}` unwrap on 2xx, flat
|
|
323
|
+
* `{code, message}` → {@link HostedApiError} on non-2xx. EVERY failure is
|
|
324
|
+
* typed: a rejected fetch → `network_error`, the timeout → `timeout`, an
|
|
325
|
+
* unparseable 2xx body → `unknown_error` — the page never sees a raw
|
|
326
|
+
* TypeError/DOMException. Automatic retries: 409 `idempotency_in_progress`
|
|
327
|
+
* (bounded, short delay), and ONE retry of a 503 `server_busy` /
|
|
328
|
+
* `request_timeout` after its `Retry-After` (default 2 s, capped at 20 s, ±25 %
|
|
329
|
+
* jitter) when the call is safe to repeat: every GET, and a POST that sets
|
|
330
|
+
* `busyRetry`. The wait runs between requests, outside each request's timeout.
|
|
331
|
+
*/
|
|
332
|
+
private api;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** Luma at or above this counts as clipped / specular. */
|
|
336
|
+
declare const CLIPPED_LUMA = 250;
|
|
337
|
+
/** Laplacian-variance reference (same as the liveness gate's frame-quality SHARP_REF). */
|
|
338
|
+
declare const ICAO_SHARP_REF = 180;
|
|
339
|
+
interface LumaPlane {
|
|
340
|
+
data: Uint8Array;
|
|
341
|
+
width: number;
|
|
342
|
+
height: number;
|
|
343
|
+
}
|
|
344
|
+
/** Rec.601 luma of RGBA pixels. */
|
|
345
|
+
declare function lumaPlane(image: {
|
|
346
|
+
data: Uint8ClampedArray | Uint8Array;
|
|
347
|
+
width: number;
|
|
348
|
+
height: number;
|
|
349
|
+
}): LumaPlane;
|
|
350
|
+
interface RegionStats {
|
|
351
|
+
mean: number;
|
|
352
|
+
sd: number;
|
|
353
|
+
/** Fraction of pixels at or above {@link CLIPPED_LUMA}. */
|
|
354
|
+
clipped: number;
|
|
355
|
+
count: number;
|
|
356
|
+
}
|
|
357
|
+
/** Mean / SD / clipped fraction of a box, optionally excluding a second box. */
|
|
358
|
+
declare function regionStats(plane: LumaPlane, box: Box, exclude?: Box): RegionStats;
|
|
359
|
+
interface FaceLighting {
|
|
360
|
+
faceLuma: number;
|
|
361
|
+
/** Left-half / right-half mean luma (image halves, split at the nose). */
|
|
362
|
+
halfRatio: number;
|
|
363
|
+
clipped: number;
|
|
364
|
+
}
|
|
365
|
+
declare function faceLighting(plane: LumaPlane, g: FaceGeometry): FaceLighting | null;
|
|
366
|
+
/** Specular fraction inside both eye regions (spec §5.4 glasses glare). */
|
|
367
|
+
declare function eyeSpecular(plane: LumaPlane, g: FaceGeometry): number | null;
|
|
368
|
+
interface BackgroundStats {
|
|
369
|
+
luma: number;
|
|
370
|
+
sd: number;
|
|
371
|
+
/** Pixels measured — too few means the corners left the frame. */
|
|
372
|
+
count: number;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Background heuristic: the two top corners of the ICAO window (each 20 % wide,
|
|
376
|
+
* 25 % tall from 4 % down), minus the head (the face box widened by 40 % and
|
|
377
|
+
* extended to the top of the window for hair). `null` when nothing is left.
|
|
378
|
+
*/
|
|
379
|
+
declare function backgroundStats(plane: LumaPlane, g: FaceGeometry): BackgroundStats | null;
|
|
380
|
+
/** Laplacian variance over the face core on a ≤96×96 grid, normalised 0..1 by {@link ICAO_SHARP_REF}. */
|
|
381
|
+
declare function faceSharpness(plane: LumaPlane, g: FaceGeometry): number | null;
|
|
382
|
+
/** Every pixel measure of one frame (`null` fields: not measurable). */
|
|
383
|
+
interface IcaoPixelStats {
|
|
384
|
+
lighting: FaceLighting | null;
|
|
385
|
+
eyeSpecular: number | null;
|
|
386
|
+
background: BackgroundStats | null;
|
|
387
|
+
sharpness: number | null;
|
|
388
|
+
}
|
|
389
|
+
declare function icaoPixelStats(plane: LumaPlane, g: FaceGeometry): IcaoPixelStats;
|
|
390
|
+
|
|
391
|
+
/** The client gate's criteria, in coaching priority order. */
|
|
392
|
+
declare const ICAO_GATE_CRITERIA: readonly ["face", "framing", "pose", "eyes", "mouth", "glare", "lighting", "background", "resolution", "sharpness"];
|
|
393
|
+
type IcaoGateCriterion = (typeof ICAO_GATE_CRITERIA)[number];
|
|
394
|
+
/** Coaching keys (copy `portrait.coach.<key>`). */
|
|
395
|
+
type IcaoCoachKey = "no_face" | "multiple_faces" | "center" | "too_close" | "pose" | "eyes" | "mouth" | "glare" | "lighting" | "lighting_side" | "background" | "resolution" | "hold_still" | "hold";
|
|
396
|
+
/** One frame as the gate sees it. Geometry in SOURCE (stream) pixels. */
|
|
397
|
+
interface IcaoFrameObservation {
|
|
398
|
+
frameWidth: number;
|
|
399
|
+
frameHeight: number;
|
|
400
|
+
/** Faces the landmarker found (the gate wants exactly one). */
|
|
401
|
+
faces: number;
|
|
402
|
+
geometry: FaceGeometry | null;
|
|
403
|
+
/** Facial transformation matrix (4×4, column-major), when produced. */
|
|
404
|
+
matrix?: readonly number[] | null;
|
|
405
|
+
/** Blendshape scores by category name (`eyeBlinkLeft`, `jawOpen`, …). */
|
|
406
|
+
blendshapes?: Readonly<Record<string, number>> | null;
|
|
407
|
+
/** Pixel heuristics on the analysis frame; `null` when not measured. */
|
|
408
|
+
stats?: IcaoPixelStats | null;
|
|
409
|
+
/**
|
|
410
|
+
* The background-uniformity check (segmenter, or the strip fallback), the
|
|
411
|
+
* latest measurement — it runs a few times per second, not on every frame.
|
|
412
|
+
* When present it decides the `background` criterion; `null` = not measurable.
|
|
413
|
+
*/
|
|
414
|
+
backgroundCheck?: BackgroundUniformity | null;
|
|
415
|
+
}
|
|
416
|
+
interface IcaoCriterionState {
|
|
417
|
+
criterion: IcaoGateCriterion;
|
|
418
|
+
pass: boolean;
|
|
419
|
+
/** Passed continuously for `holdMs`. */
|
|
420
|
+
held: boolean;
|
|
421
|
+
/** A failing soft criterion the gate stopped waiting for. */
|
|
422
|
+
waived: boolean;
|
|
423
|
+
/** The measured value (degrees, ratio, luma, px…) — coaching / telemetry only. */
|
|
424
|
+
value: number | null;
|
|
425
|
+
/** Coaching key when failing. */
|
|
426
|
+
coach: IcaoCoachKey | null;
|
|
427
|
+
}
|
|
428
|
+
interface IcaoGateUpdate {
|
|
429
|
+
criteria: IcaoCriterionState[];
|
|
430
|
+
/** The one message to show (`hold` when everything passes and the gate is counting down). */
|
|
431
|
+
coach: IcaoCoachKey;
|
|
432
|
+
/** The lowest failing criterion (`null` when all pass or are waived). */
|
|
433
|
+
failing: IcaoGateCriterion | null;
|
|
434
|
+
/** 0..1 — held criteria, for a progress ring. */
|
|
435
|
+
progress: number;
|
|
436
|
+
/** Take the portrait frame now. */
|
|
437
|
+
ready: boolean;
|
|
438
|
+
/**
|
|
439
|
+
* The user's own eye-openness baseline, once known. Unit (D9d, everywhere): openness =
|
|
440
|
+
* 1 − the Landmarker's `eyeBlink{Left,Right}` blendshape; per frame the mean of the
|
|
441
|
+
* two eyes; the baseline is the `baseline.percentile` (0.8) quantile over the recent
|
|
442
|
+
* frontal, single-face frames. kyc-portrait compares the lower eye against it.
|
|
443
|
+
*/
|
|
444
|
+
baseline: number | null;
|
|
445
|
+
/** The same quantile of each eye alone (2026-11-06): what each eye is judged against; `null` until known. */
|
|
446
|
+
baselines: {
|
|
447
|
+
left: number;
|
|
448
|
+
right: number;
|
|
449
|
+
} | null;
|
|
450
|
+
pose: HeadPose | null;
|
|
451
|
+
}
|
|
452
|
+
/** The on-device result submitted with the portrait (`gate`, §4.9): numbers only. */
|
|
453
|
+
interface IcaoGateSummary {
|
|
454
|
+
/** In (0, 1]: the gate's eye baseline (1 − blink blendshape; see {@link IcaoGateUpdate.baseline}). */
|
|
455
|
+
baselineEyeOpenness?: number;
|
|
456
|
+
/** In (0, 1], both or neither: the baseline of each eye, which selects kyc-portrait's per-eye rule. */
|
|
457
|
+
baselineEyeOpennessLeft?: number;
|
|
458
|
+
baselineEyeOpennessRight?: number;
|
|
459
|
+
criteria: Partial<Record<IcaoGateCriterion, {
|
|
460
|
+
pass: boolean;
|
|
461
|
+
value: number | null;
|
|
462
|
+
waived?: boolean;
|
|
463
|
+
}>>;
|
|
464
|
+
/**
|
|
465
|
+
* The device verdict with the server's criterion names — the submission's
|
|
466
|
+
* `gate.criteria`: `framing` folds into `resolution`, unmeasured criteria are
|
|
467
|
+
* omitted (occlusion always; background when the profile does not require it).
|
|
468
|
+
*/
|
|
469
|
+
verdict?: Partial<Record<IcaoCriterion, boolean>>;
|
|
470
|
+
/** The background-uniformity measurement behind the `background` criterion (numbers only). */
|
|
471
|
+
backgroundCheck?: Omit<BackgroundUniformity, "pixels">;
|
|
472
|
+
}
|
|
473
|
+
interface Measured {
|
|
474
|
+
pass: boolean;
|
|
475
|
+
value: number | null;
|
|
476
|
+
coach: IcaoCoachKey | null;
|
|
477
|
+
/** Not measured on this frame (left out of the verdict). */
|
|
478
|
+
none?: true;
|
|
479
|
+
}
|
|
480
|
+
/** The criteria a profile sets limits for (conformance.json `criteria`). */
|
|
481
|
+
type IcaoJudgedCriterion = "pose" | "eyes" | "mouth" | "lighting" | "background" | "resolution";
|
|
482
|
+
/**
|
|
483
|
+
* One frame's measures in the server's units (conformance.json `measures`);
|
|
484
|
+
* `null` = not measured on this frame.
|
|
485
|
+
*/
|
|
486
|
+
interface IcaoMeasures {
|
|
487
|
+
/** Degrees; `pitch` is RAW (before `pitchOffsetDeg`). `null` = no transformation matrix. */
|
|
488
|
+
pose: HeadPose | null;
|
|
489
|
+
/** The value shown for a pose without matrix (roll from the eye line). */
|
|
490
|
+
eyeLineRoll?: number;
|
|
491
|
+
/** Openness of each eye (1 − the `eyeBlink*` blendshape). */
|
|
492
|
+
eyes: {
|
|
493
|
+
left: number;
|
|
494
|
+
right: number;
|
|
495
|
+
} | null;
|
|
496
|
+
/** The person's eye-openness baseline; `null` = the absolute floor only. */
|
|
497
|
+
baseline: number | null;
|
|
498
|
+
/** The baseline of each eye: when known, each eye is judged against its own (a stable asymmetry passes). */
|
|
499
|
+
baselines?: {
|
|
500
|
+
left: number;
|
|
501
|
+
right: number;
|
|
502
|
+
} | null;
|
|
503
|
+
/** Blendshapes: `jawOpen`, the larger `mouthSmile*`, `mouthPucker`. */
|
|
504
|
+
mouth: {
|
|
505
|
+
jawOpen: number;
|
|
506
|
+
smile: number;
|
|
507
|
+
pucker: number;
|
|
508
|
+
} | null;
|
|
509
|
+
lighting: {
|
|
510
|
+
faceLuma: number;
|
|
511
|
+
halfRatio: number;
|
|
512
|
+
clipped: number;
|
|
513
|
+
} | null;
|
|
514
|
+
background: {
|
|
515
|
+
luma: number;
|
|
516
|
+
sd: number;
|
|
517
|
+
} | null;
|
|
518
|
+
/** The web background-uniformity check; when present (and enabled) it decides the background. */
|
|
519
|
+
uniformity?: Pick<BackgroundUniformity, "uniform" | "colorStd"> | null;
|
|
520
|
+
iod: number;
|
|
521
|
+
frameWidth: number;
|
|
522
|
+
frameHeight: number;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* The per-criterion decision on one frame's measures — pure, the same rule as
|
|
526
|
+
* kyc-portrait and the native gates (packages/sekyro-contract/icao/conformance.json;
|
|
527
|
+
* limits are inclusive).
|
|
528
|
+
*/
|
|
529
|
+
declare function judgeIcao(m: IcaoMeasures, t: ResolvedIcaoTuning): Record<IcaoJudgedCriterion, Measured>;
|
|
530
|
+
/** Openness of one eye from the Landmarker's blink blendshape (1 − blink). */
|
|
531
|
+
declare function eyeOpenness(blendshapes: Readonly<Record<string, number>> | null | undefined): {
|
|
532
|
+
left: number;
|
|
533
|
+
right: number;
|
|
534
|
+
blinkLeft: number;
|
|
535
|
+
blinkRight: number;
|
|
536
|
+
} | null;
|
|
537
|
+
/** The `p`-quantile (0..1) of a sample, nearest-rank. */
|
|
538
|
+
declare function percentile(values: readonly number[], p: number): number | null;
|
|
539
|
+
/** Score one frame against the limits. Pure; `baseline` and `baselines` are the eye baselines so far. */
|
|
540
|
+
declare function scoreFrame(frame: IcaoFrameObservation, t: ResolvedIcaoTuning, baseline: number | null, baselines?: {
|
|
541
|
+
left: number;
|
|
542
|
+
right: number;
|
|
543
|
+
} | null): {
|
|
544
|
+
results: Record<IcaoGateCriterion, Measured>;
|
|
545
|
+
pose: HeadPose | null;
|
|
546
|
+
};
|
|
547
|
+
/** One frame's mouth blendshapes, rounded to 3 decimals (diagnostics: numbers only). */
|
|
548
|
+
interface IcaoMouthScores {
|
|
549
|
+
jawOpen: number;
|
|
550
|
+
smile: number;
|
|
551
|
+
pucker: number;
|
|
552
|
+
}
|
|
553
|
+
/** The mouth scores of this gate run, for the staff diagnostics (`portrait_gate` report, 2026-11-06). */
|
|
554
|
+
interface IcaoGateScores {
|
|
555
|
+
/** Since the first frame with scores of this run. */
|
|
556
|
+
elapsedMs: number;
|
|
557
|
+
latest: IcaoMouthScores;
|
|
558
|
+
/** The smallest value of each score over the run: how close the person got to each limit. */
|
|
559
|
+
lowest: IcaoMouthScores;
|
|
560
|
+
}
|
|
561
|
+
interface IcaoGate {
|
|
562
|
+
push(frame: IcaoFrameObservation, nowMs: number): IcaoGateUpdate;
|
|
563
|
+
/** The run's mouth scores (`null` before a frame had any). A retake starts a new run. */
|
|
564
|
+
scores(): IcaoGateScores | null;
|
|
565
|
+
/** The last update (`null` before the first frame). */
|
|
566
|
+
last(): IcaoGateUpdate | null;
|
|
567
|
+
/** The submission's `gate` block from the last update. */
|
|
568
|
+
summary(): IcaoGateSummary;
|
|
569
|
+
/** Start the holds over (a retake). The eye baseline is kept: it describes the person. */
|
|
570
|
+
reset(): void;
|
|
571
|
+
}
|
|
572
|
+
interface IcaoGateOptions {
|
|
573
|
+
/** `alert`: coaching only — ready `alertGraceMs` after the face was accepted at the latest. Default `reject`. */
|
|
574
|
+
policy?: "reject" | "alert";
|
|
575
|
+
}
|
|
576
|
+
declare function createIcaoGate(t: ResolvedIcaoTuning, options?: IcaoGateOptions): IcaoGate;
|
|
577
|
+
|
|
578
|
+
export { faceGeometry as A, type BackgroundStats as B, CLIPPED_LUMA as C, faceLighting as D, faceSharpness as E, type FaceGeometry as F, icaoPixelStats as G, HostedClient as H, type IcaoCoachKey as I, icaoWindow as J, judgeIcao as K, type LumaPlane as L, type MediaCheckType as M, lumaPlane as N, percentile as O, type Point as P, portraitCropRegion as Q, type RegionStats as R, SEKYRO_SDK_HEADER as S, poseFromMatrix as T, type UploadMedia as U, regionStats as V, scoreFrame as W, windowOverflow as X, type HostedClientOptions as a, type SubmitOptions as b, type HeadPose as c, type IcaoCriterionState as d, type IcaoGateCriterion as e, type IcaoGateSummary as f, type IcaoGateUpdate as g, type Box as h, type FaceLighting as i, ICAO_CANVAS as j, ICAO_GATE_CRITERIA as k, ICAO_SHARP_REF as l, type IcaoFrameObservation as m, type IcaoGate as n, type IcaoGateOptions as o, type IcaoGateScores as p, type IcaoJudgedCriterion as q, type IcaoMeasures as r, stripMimeParams as s, type IcaoMouthScores as t, type IcaoPixelStats as u, backgroundStats as v, createIcaoGate as w, eyeLineRoll as x, eyeOpenness as y, eyeSpecular as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as a,i as b,j as c,k as d,l as e,m as f}from"./chunk-53POX7U4.js";export{a as ICAO_GATE_CRITERIA,f as createIcaoGate,c as eyeOpenness,b as judgeIcao,d as percentile,e as scoreFrame};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { f as IcaoGateSummary } from './icao-gate-Cp1C4IEZ.js';
|
|
2
|
+
import { a9 as HostedSessionView, Y as HostedIcaoPolicy, aT as PortraitIcaoInput } from './types-B47mZ5TT.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Every error code the hosted page can receive from the session-token surface.
|
|
6
|
+
* A closed string-literal union — switch over {@link KnownCode} with a `never`
|
|
7
|
+
* default arm for compile-checked exhaustiveness.
|
|
8
|
+
*/
|
|
9
|
+
declare const KNOWN_CODES: readonly ["session_token_invalid", "session_token_required", "session_token_session_mismatch", "session_not_found", "rate_limit_exceeded", "consent_required", "session_not_active", "check_not_found", "check_already_finalized", "check_out_of_order", "check_type_unsupported", "force_outcome_forbidden", "attestation_invalid", "platform_unregistered", "app_attest_invalid", "too_many_challenges", "inference_unavailable", "mobile_required", "nni_locked", "document_nni_mismatch", "media_content_type_not_allowed", "media_too_large", "media_key_invalid", "media_key_forbidden", "media_not_found", "media_unreadable", "media_session_invalid", "idempotency_key_collision", "idempotency_in_progress", "idempotency_key_required", "validation_error", "internal_error", "unknown_error", "upload_failed", "network_error", "timeout", "nfc_outcome_not_accepted", "identity_confirm_required", "identity_confirm_locked", "choice_not_found", "choice_locked", "choice_option_unavailable", "step_not_on_path", "check_not_active", "sekyro_app_not_allowed", "sekyro_app_unverified", "id_number_locked", "document_id_number_mismatch", "simulated_capture_forbidden", "native_app_required"];
|
|
10
|
+
/** Closed union of {@link KNOWN_CODES} — exhaustively switchable. */
|
|
11
|
+
type KnownCode = (typeof KNOWN_CODES)[number];
|
|
12
|
+
/** Narrow an arbitrary wire code to the known union (unknown codes stay `string`). */
|
|
13
|
+
declare function isKnownCode(code: string): code is KnownCode;
|
|
14
|
+
/** One machine-readable problem of an error's `details` (Sekyro flows spec §9.4). */
|
|
15
|
+
interface HostedErrorIssue {
|
|
16
|
+
code: string;
|
|
17
|
+
message: string;
|
|
18
|
+
/** The request field (`option`, `nodeId`, …). */
|
|
19
|
+
path?: string;
|
|
20
|
+
/** A node of the flow. */
|
|
21
|
+
nodeId?: string;
|
|
22
|
+
service?: string;
|
|
23
|
+
field?: string;
|
|
24
|
+
}
|
|
25
|
+
/** `details` of a flow error envelope (`choice_*`, `step_not_on_path`, …): the issues, and more per code. */
|
|
26
|
+
interface HostedErrorDetails {
|
|
27
|
+
issues: HostedErrorIssue[];
|
|
28
|
+
/** `override_widens_flow`: the widened fields. */
|
|
29
|
+
fields?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* `form_answers_invalid` (spec 2026-11-14 §14): one entry per refused question or consent, its id and the server's
|
|
32
|
+
* code (`required`, `invalid`, `too_short`, `too_long`, `not_a_choice`, `out_of_range`, `not_in_past`, `not_in_future`,
|
|
33
|
+
* `not_an_integer`, `card_number`, `unknown_question`, `consent_required`), never the value. `issues` is then empty.
|
|
34
|
+
*/
|
|
35
|
+
errors?: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
code: string;
|
|
38
|
+
}>;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Typed transport error: EVERY failure surfaces as one of these — non-2xx
|
|
43
|
+
* responses, rejected fetches, timeouts, and unparseable bodies alike. The
|
|
44
|
+
* hosted page never sees a raw TypeError/DOMException from the client.
|
|
45
|
+
*
|
|
46
|
+
* - `code` — the public envelope's `code`, or a client-synthesized fallback
|
|
47
|
+
* ('unknown_error' / 'upload_failed' / 'network_error' / 'timeout'). Typed
|
|
48
|
+
* `string` because the wire may grow codes; narrow with {@link isKnownCode}
|
|
49
|
+
* before an exhaustive switch.
|
|
50
|
+
* - `status` — the HTTP status, or 0 when no response arrived at all
|
|
51
|
+
* ('network_error' / 'timeout').
|
|
52
|
+
* - `retryAfterSeconds` — parsed from the `Retry-After` header when present
|
|
53
|
+
* (rate-limit 429s always set it).
|
|
54
|
+
* - `details` — the envelope's machine-readable `details` when present (flow
|
|
55
|
+
* errors: `issues[]`).
|
|
56
|
+
*/
|
|
57
|
+
declare class HostedApiError extends Error {
|
|
58
|
+
readonly status: number;
|
|
59
|
+
readonly code: string;
|
|
60
|
+
readonly retryAfterSeconds?: number;
|
|
61
|
+
readonly details?: HostedErrorDetails;
|
|
62
|
+
constructor(args: {
|
|
63
|
+
status: number;
|
|
64
|
+
code: string;
|
|
65
|
+
message: string;
|
|
66
|
+
retryAfterSeconds?: number;
|
|
67
|
+
details?: HostedErrorDetails | undefined;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** The session's ICAO policy and profile, or `null` when the selfie is not ICAO-checked. */
|
|
72
|
+
declare function icaoPolicyOf(view: Pick<HostedSessionView, "portrait"> | null | undefined): HostedIcaoPolicy | null;
|
|
73
|
+
/**
|
|
74
|
+
* The `gate` block of a `portrait_icao` body from the gate's summary: the eye
|
|
75
|
+
* baseline, the device verdict under the server's criterion names, and the
|
|
76
|
+
* background-uniformity numbers (telemetry).
|
|
77
|
+
*/
|
|
78
|
+
declare function portraitIcaoGate(summary: IcaoGateSummary): NonNullable<PortraitIcaoInput["gate"]>;
|
|
79
|
+
|
|
80
|
+
export { HostedApiError as H, KNOWN_CODES as K, type HostedErrorDetails as a, type HostedErrorIssue as b, type KnownCode as c, isKnownCode as d, icaoPolicyOf as i, portraitIcaoGate as p };
|