@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.
- package/CHANGELOG.md +427 -0
- package/LICENSE +25 -16
- package/README.md +150 -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-ESEZJBQM.js +1 -0
- package/dist/{capture-session-v3-CvIfcwST.d.ts → capture-session-v3-CTQL6eFd.d.cts} +259 -13
- package/dist/{capture-session-v3-COIO_F2w.d.cts → capture-session-v3-DHlOE6cS.d.ts} +259 -13
- package/dist/challenge-frame-YAQJ5YMB.js +1 -0
- package/dist/chunk-2LDOXGY3.js +1 -0
- package/dist/chunk-33KKMPJ5.js +1 -0
- package/dist/chunk-3LMJ4335.js +1 -0
- package/dist/chunk-53POX7U4.js +1 -0
- package/dist/chunk-7252SFZ6.js +1 -0
- package/dist/chunk-7QZWBDI5.js +1 -0
- package/dist/chunk-A7QFTU6M.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-JLVZ35QK.js +2 -0
- package/dist/chunk-KA43AAM7.js +1 -0
- package/dist/chunk-KXFHVAYQ.js +1 -0
- package/dist/chunk-ODI4A5K4.js +1 -0
- package/dist/chunk-OEQJ62CC.js +3 -0
- package/dist/chunk-POIQGEZM.js +1 -0
- package/dist/chunk-RI3E7GBN.js +1 -0
- package/dist/chunk-S5BUCUZ4.js +1 -0
- package/dist/chunk-SLKRT74K.js +1 -0
- package/dist/chunk-SMKCBUJL.js +1 -0
- package/dist/chunk-SX7TUC3V.js +1 -0
- package/dist/chunk-TSA6GHUG.js +1 -0
- package/dist/chunk-UTPUHE4J.js +1 -0
- package/dist/chunk-VVUQ4PFU.js +1 -0
- package/dist/chunk-VWGKUQ3C.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-V7XCRRDV.js +1 -0
- package/dist/create-portrait-capture-5VGYZUOK.js +1 -0
- package/dist/create-verification-CGBe2yLE.d.cts +3719 -0
- package/dist/create-verification-aoY2QoRx.d.ts +3719 -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-SE3CL55N.js +1 -0
- package/dist/icao-gate-DveU9Cr8.d.ts +573 -0
- package/dist/icao-gate-T3BTOKFJ.js +1 -0
- package/dist/icao-gate-xyWB7dz2.d.cts +573 -0
- package/dist/icao-policy-BWu1JLgi.d.cts +80 -0
- package/dist/icao-policy-OOEQDG9_.d.ts +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-IXCKR4DB.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-CezFEXzl.d.cts +2103 -0
- package/dist/types-CezFEXzl.d.ts +2103 -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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { br as ScreenRampReport, bi as CaptureProvenance, bo as ScreenRampChallenge, bp as ScreenRampPaint } from './types-CezFEXzl.cjs';
|
|
2
|
+
import { F as FaceObservation, b as Detector, W as WorkerLike } from './detect-worker-CHqsPJoM.cjs';
|
|
2
3
|
|
|
3
4
|
/** MP4-first ladder: one container (H.264 MP4) covers iOS/macOS Safari + Chrome 130+.
|
|
4
5
|
* WebM/VP9→VP8 only as the Firefox/older-Chromium fallback. */
|
|
@@ -28,19 +29,60 @@ declare function buildLivenessV2FormData(args: {
|
|
|
28
29
|
ts?: number;
|
|
29
30
|
}): FormData;
|
|
30
31
|
|
|
32
|
+
interface ClipStats {
|
|
33
|
+
container: "mp4" | "webm";
|
|
34
|
+
/** Video frames (samples / blocks) in the clip. */
|
|
35
|
+
frames: number;
|
|
36
|
+
/** Video duration in ms: the sample durations (MP4), or the first-to-last frame span plus one frame (WebM). */
|
|
37
|
+
durationMs: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
declare const CLIP_MS = 2500;
|
|
32
41
|
declare const TIMESLICE_MS = 1000;
|
|
33
42
|
declare const STOP_GRACE_MS = 1500;
|
|
34
43
|
declare const VIDEO_BPS = 2500000;
|
|
44
|
+
/** After the frame clock has covered the window: time for the encoder to hand over the last frames before stop(). */
|
|
45
|
+
declare const ENCODER_TAIL_MS = 100;
|
|
46
|
+
/** Hard cap past `clipMs` (from start()) when the frame clock is slow or stalls. */
|
|
47
|
+
declare const MAX_OVERRUN_MS = 700;
|
|
48
|
+
/** How often the frame clock is read while recording. */
|
|
49
|
+
declare const FRAME_POLL_MS = 20;
|
|
50
|
+
/** How long a finished clip waits for the container reader chunk before it ships unmeasured. */
|
|
51
|
+
declare const INSPECT_WAIT_MS = 1500;
|
|
52
|
+
/** The preview's frame clock: the latest presented frame (`performance.now()` domain), null before the first. */
|
|
53
|
+
interface FrameClock {
|
|
54
|
+
latest(): {
|
|
55
|
+
presentationTimeMs: number;
|
|
56
|
+
} | null;
|
|
57
|
+
}
|
|
35
58
|
type ClipErrorKind = CameraErrorKind | "cliptoolarge";
|
|
36
59
|
declare class ClipError extends Error {
|
|
37
60
|
kind: ClipErrorKind;
|
|
61
|
+
/** The type the recorder was asked for when it failed (set by record()). */
|
|
62
|
+
requestedMimeType?: string;
|
|
38
63
|
constructor(kind: ClipErrorKind, msg?: string);
|
|
39
64
|
}
|
|
65
|
+
/** A clip this much shorter than its window is recorded again (once). */
|
|
66
|
+
declare const SHORT_CLIP_TOLERANCE_MS = 100;
|
|
67
|
+
/** A measured clip under `windowMs - SHORT_CLIP_TOLERANCE_MS`, or one whose container could not be read. An
|
|
68
|
+
* unmeasured clip (`stats` absent: a host-supplied recorder) never is. Low frame rate alone is not a reason:
|
|
69
|
+
* a second take on the same encoder would not raise it. */
|
|
70
|
+
declare function needsRetake(clip: Pick<ClipResult, "stats">, windowMs: number): boolean;
|
|
71
|
+
/** `candidate` is the better clip: readable over unreadable, then the longer one. */
|
|
72
|
+
declare function betterTake(candidate: Pick<ClipResult, "stats">, current: Pick<ClipResult, "stats">): boolean;
|
|
40
73
|
interface ClipResult {
|
|
41
74
|
blob: Blob;
|
|
42
75
|
/** Container mime the clip was finalized with (recorder.mimeType || picked || DEFAULT_CLIP_MIME). */
|
|
43
76
|
mimeType: string;
|
|
77
|
+
/** The type the recorder was asked for ("" = the browser default): what a failed take notes as failed. */
|
|
78
|
+
requestedMimeType?: string;
|
|
79
|
+
/** Frames and duration read from the finished container; `null` when it could not be read (a broken clip),
|
|
80
|
+
* absent when the clip was not measured (a host-supplied recorder). */
|
|
81
|
+
stats?: ClipStats | null;
|
|
82
|
+
}
|
|
83
|
+
interface ClipRecorderOptions {
|
|
84
|
+
/** Clock in the frame clock's domain (default `performance.now()`); tests inject it. */
|
|
85
|
+
now?: () => number;
|
|
44
86
|
}
|
|
45
87
|
declare class ClipRecorder {
|
|
46
88
|
private recorder;
|
|
@@ -49,7 +91,10 @@ declare class ClipRecorder {
|
|
|
49
91
|
private bytes;
|
|
50
92
|
private hardStopTimer;
|
|
51
93
|
private graceTimer;
|
|
94
|
+
private pollTimer;
|
|
52
95
|
private settled;
|
|
96
|
+
private readonly now;
|
|
97
|
+
constructor(options?: ClipRecorderOptions);
|
|
53
98
|
private clearTimers;
|
|
54
99
|
/** Records CLIP_MS of the stream. Resolves with the clip blob + its container mime;
|
|
55
100
|
* rejects with ClipError. Behavior contract is the v1 hook's `start`, verbatim
|
|
@@ -67,8 +112,20 @@ declare class ClipRecorder {
|
|
|
67
112
|
* instead of waiting for the blob. PURE NOTIFICATION — it does not touch
|
|
68
113
|
* timers, chunks, or the finalize path, so it is calibration-neutral (no
|
|
69
114
|
* effect on clip bytes). Never fires on a rejected capture (error /
|
|
70
|
-
* cliptoolarge settle before the hard-stop and clear the timer).
|
|
71
|
-
|
|
115
|
+
* cliptoolarge settle before the hard-stop and clear the timer).
|
|
116
|
+
*
|
|
117
|
+
* `onStarted` (optional, liveness v7 §4.4) fires ONCE on the recorder's
|
|
118
|
+
* `start` event: the zero of the clip's own timeline, which the screen ramp
|
|
119
|
+
* stamps its colour changes against. PURE NOTIFICATION as well (the
|
|
120
|
+
* `onstart` handler was unset before; nothing else changes), so it is
|
|
121
|
+
* calibration-neutral. Never fires when construction or `start()` failed.
|
|
122
|
+
*
|
|
123
|
+
* `clipMs` (optional) is the recording window, CLIP_MS (2.5 s) by default; a screen-ramp capture passes the
|
|
124
|
+
* challenge's `clipMs` (same 4th parameter as the ramp-v2 change). `frames` (optional) is the preview's frame
|
|
125
|
+
* clock: with it the window is measured on presented frames from the recorder's start (see the header), without
|
|
126
|
+
* it the v1 wall-clock stop at `clipMs` applies. The resolved clip carries its measured `stats`. */
|
|
127
|
+
record(stream: MediaStream, onStopped?: () => void, onStarted?: () => void, clipMs?: number, frames?: FrameClock): Promise<ClipResult>;
|
|
128
|
+
private recordRaw;
|
|
72
129
|
/** Idempotent teardown: stop recorder + ALL tracks (v1 `stopAndCleanup` + the unmount
|
|
73
130
|
* effect). Optional `stream` override mirrors v1's `stopAndCleanup(stream?)`.
|
|
74
131
|
*
|
|
@@ -95,8 +152,10 @@ type CaptureState = "idle" | "preflight" | "acquiring" | "positioning" | "record
|
|
|
95
152
|
* - 'cliptoolarge' the 8 MB clip cap (shared with the liveness API contract)
|
|
96
153
|
* - 'recorder' MediaRecorder failed mid-clip. ClipRecorder's v1-verbatim kind for
|
|
97
154
|
* this is 'generic'; CaptureSession REMAPS it to 'recorder' so hosts
|
|
98
|
-
* can distinguish recorder failure from camera 'generic'.
|
|
99
|
-
|
|
155
|
+
* can distinguish recorder failure from camera 'generic'.
|
|
156
|
+
* - 'backcamera' the back camera was asked for (assisted capture) and only the front
|
|
157
|
+
* one opened: nothing is recorded (the server refuses such a clip). */
|
|
158
|
+
type CaptureErrorKind = CameraErrorKind | "models" | "cliptoolarge" | "recorder" | "backcamera";
|
|
100
159
|
/** The five v1 gate checks (hysteresis-smoothed statuses). */
|
|
101
160
|
interface GateChecks {
|
|
102
161
|
faceDetected: boolean;
|
|
@@ -105,16 +164,43 @@ interface GateChecks {
|
|
|
105
164
|
goodQuality: boolean;
|
|
106
165
|
stable: boolean;
|
|
107
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Client-side capture timing (face-capture duration, 2026-10-17), measured
|
|
169
|
+
* by the engine with its monotonic clock (`performance.now()` by default) and
|
|
170
|
+
* rounded to whole milliseconds. All fields are optional: a phase that never
|
|
171
|
+
* happened (e.g. no face ever detected before a retry) is simply absent.
|
|
172
|
+
*/
|
|
173
|
+
interface CaptureTiming {
|
|
174
|
+
/** `getUserMedia` call → stream attached and the preview playing. */
|
|
175
|
+
cameraReadyMs?: number;
|
|
176
|
+
/** Camera ready → the first tick on which the GATE accepted the face
|
|
177
|
+
* (present + size / centering / quality good enough to make progress —
|
|
178
|
+
* not merely detected). */
|
|
179
|
+
faceAcquireMs?: number;
|
|
180
|
+
/** FIRST accepted face → gate progress 100 % (capture complete, BEFORE the
|
|
181
|
+
* clip window / upload). A face lost and re-acquired keeps the first start. */
|
|
182
|
+
captureMs?: number;
|
|
183
|
+
}
|
|
108
184
|
/** Capture output. Upload is NOT the engine's job — hosts submit these themselves. */
|
|
109
185
|
interface CaptureArtifacts {
|
|
110
186
|
/** Absent in photo mode. */
|
|
111
187
|
clip?: Blob;
|
|
112
188
|
/** Container mime the clip finalized with. Absent in photo mode. */
|
|
113
189
|
clipMimeType?: string;
|
|
114
|
-
/**
|
|
190
|
+
/** The clip's frames and duration read from its container (absent when unread or in photo mode). */
|
|
191
|
+
clipStats?: ClipStats;
|
|
192
|
+
/** Silent re-recordings this clip took (0 or 1; absent in photo mode). */
|
|
193
|
+
clipRetakes?: number;
|
|
194
|
+
/** JPEG keyframe (captureMirroredKeyframe): mirrored on the front camera, as the sensor sees it on the back one. */
|
|
115
195
|
keyframe: Blob;
|
|
116
196
|
/** JPEG data URL of the keyframe canvas (v1 preview, quality 0.92). */
|
|
117
197
|
previewDataUrl: string;
|
|
198
|
+
/** Capture-phase timing of the attempt that produced these artifacts. */
|
|
199
|
+
timing?: CaptureTiming;
|
|
200
|
+
/** Liveness v7 §4.4: the screen ramp rendered against the session's issued challenge (clip mode, a challenge issued, a host painting). */
|
|
201
|
+
screenRamp?: ScreenRampReport;
|
|
202
|
+
/** Liveness v7 §4.5 item 2: how the capture was made (whenever the engine had a camera track). */
|
|
203
|
+
provenance?: CaptureProvenance;
|
|
118
204
|
}
|
|
119
205
|
interface CaptureSessionEvents {
|
|
120
206
|
statechange: {
|
|
@@ -205,7 +291,7 @@ interface V3GateTickInput {
|
|
|
205
291
|
frameWidth: number;
|
|
206
292
|
frameHeight: number;
|
|
207
293
|
}
|
|
208
|
-
type V3GateFactor = "presence" | "centering" | "size" | "pose" | "sharpness" | "exposure" | "motion";
|
|
294
|
+
type V3GateFactor = "presence" | "single" | "centering" | "size" | "pose" | "sharpness" | "exposure" | "motion";
|
|
209
295
|
/** Per-tick output — the telemetry + chrome contract. */
|
|
210
296
|
interface V3GateTick {
|
|
211
297
|
at: number;
|
|
@@ -218,6 +304,10 @@ interface V3GateTick {
|
|
|
218
304
|
guidanceKey: string;
|
|
219
305
|
/** Fire signal: p ≥ 1 AND no second bad tick (q < Q_GOOD) in READY_WINDOW_MS. */
|
|
220
306
|
ready: boolean;
|
|
307
|
+
/** The face on THIS tick is ACCEPTED by the gate — present and every factor
|
|
308
|
+
* (size, centering, pose, sharpness, exposure, motion) good enough that the
|
|
309
|
+
* integrator RISES (q ≥ Q_GOOD). The engine's "first accepted face" mark. */
|
|
310
|
+
accepted: boolean;
|
|
221
311
|
}
|
|
222
312
|
declare class FaceGateV3 {
|
|
223
313
|
private readonly t;
|
|
@@ -232,7 +322,7 @@ declare class FaceGateV3 {
|
|
|
232
322
|
private geometryOf;
|
|
233
323
|
private motionOf;
|
|
234
324
|
/** Lowest failing factor speaks — fixed priority (diagnostic, incl. light):
|
|
235
|
-
* presence → size → centering → pose → exposure → sharpness → hold.
|
|
325
|
+
* presence → single → size → centering → pose → exposure → sharpness → hold.
|
|
236
326
|
*
|
|
237
327
|
* HONESTY FALLBACK (operator ruling 2026-07-12): when every factor clears
|
|
238
328
|
* its guide threshold but q (= min factor) is still below Q_GOOD — i.e.
|
|
@@ -289,9 +379,56 @@ declare class DeviceProfiler {
|
|
|
289
379
|
record(detectMs: number): DeviceClass;
|
|
290
380
|
}
|
|
291
381
|
|
|
382
|
+
/** Where a capture failed: the engine step that was running. */
|
|
383
|
+
type CaptureErrorPhase = "preflight" | "acquiring" | "models" | "recording" | "keyframes" | "upload";
|
|
384
|
+
/** Engine-side failure detail (the public handle adds the engine kind). */
|
|
385
|
+
interface EngineErrorDetail {
|
|
386
|
+
phase: CaptureErrorPhase;
|
|
387
|
+
/** The thrown error's `name` only, sanitised by {@link errorNameOf}. */
|
|
388
|
+
name?: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/** Why a gate tick did not advance: no face, or the weakest gate check. */
|
|
392
|
+
type GateBlockReason = "no_face" | Exclude<V3GateFactor, "presence">;
|
|
393
|
+
interface GateBlockEntry {
|
|
394
|
+
/** Ticks blocked by this reason. */
|
|
395
|
+
count: number;
|
|
396
|
+
/** Wall time (whole ms) those ticks covered. */
|
|
397
|
+
ms: number;
|
|
398
|
+
}
|
|
399
|
+
interface GateBlockSummary {
|
|
400
|
+
/** Only the reasons that blocked at least once. */
|
|
401
|
+
blocked: Partial<Record<GateBlockReason, GateBlockEntry>>;
|
|
402
|
+
/** Wall time (whole ms) of ticks the gate accepted (progress rising). */
|
|
403
|
+
acceptedMs: number;
|
|
404
|
+
/** Total ticks seen. */
|
|
405
|
+
ticks: number;
|
|
406
|
+
}
|
|
407
|
+
/** The reason one tick was held back, or null when the gate accepted it. */
|
|
408
|
+
declare function blockReasonOf(tick: Pick<V3GateTick, "accepted" | "factors">): GateBlockReason | null;
|
|
409
|
+
declare class GateBlockStats {
|
|
410
|
+
private blocked;
|
|
411
|
+
private acceptedMs;
|
|
412
|
+
private ticks;
|
|
413
|
+
private lastAt;
|
|
414
|
+
/** Record one gate tick; the time since the previous tick is charged to THIS tick's state. */
|
|
415
|
+
record(tick: Pick<V3GateTick, "at" | "accepted" | "factors">): void;
|
|
416
|
+
summary(): GateBlockSummary;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/** A non-final `gate` telemetry snapshot at most this often while positioning
|
|
420
|
+
* (so an abandoned attempt still reports where its time went). */
|
|
421
|
+
declare const GATE_SNAPSHOT_MS = 1000;
|
|
422
|
+
/** Guidance key while a phone shows a landscape camera frame (the upright guard). */
|
|
423
|
+
declare const HOLD_UPRIGHT_KEY = "fcv3.hold_upright";
|
|
424
|
+
/** How often the upright guard re-reads the frame size while the clip records (plus every `resize` event). */
|
|
425
|
+
declare const UPRIGHT_WATCH_MS = 200;
|
|
292
426
|
/** Best-of-N keyframe window: up to 4 candidates over the first 600ms. */
|
|
293
427
|
declare const KEYFRAME_CANDIDATES = 4;
|
|
294
428
|
declare const KEYFRAME_WINDOW_MS = 600;
|
|
429
|
+
/** Liveness v7 §4.5 item 2: the longest the capture waits on the track description (its WebCrypto hash) once the
|
|
430
|
+
* clip is done; past it the artifacts ship without `provenance`. */
|
|
431
|
+
declare const PROVENANCE_WAIT_MS = 1000;
|
|
295
432
|
interface V3ChecksPayload {
|
|
296
433
|
engine: "v3";
|
|
297
434
|
/** Gate integrator 0..1 — the ring drives off this directly. */
|
|
@@ -312,9 +449,11 @@ interface CaptureSessionV3Events {
|
|
|
312
449
|
key: string;
|
|
313
450
|
};
|
|
314
451
|
artifacts: CaptureArtifacts;
|
|
452
|
+
/** `detail`: where the attempt failed and the thrown error's name (never its message). */
|
|
315
453
|
error: {
|
|
316
454
|
kind: CaptureErrorKind;
|
|
317
455
|
retryable: boolean;
|
|
456
|
+
detail?: EngineErrorDetail;
|
|
318
457
|
};
|
|
319
458
|
/** v3-only, CHROME-only (no data flows here): fires the instant the clip
|
|
320
459
|
* recording window ends — BEFORE the blob finalizes (iOS onstop can lag up
|
|
@@ -325,6 +464,12 @@ interface CaptureSessionV3Events {
|
|
|
325
464
|
frozen: {
|
|
326
465
|
previewDataUrl: string;
|
|
327
466
|
};
|
|
467
|
+
/** Ramp v2: paint the full-screen screen-ramp layer this colour, black (`"dark"`, the dark-gap arm) or clear it
|
|
468
|
+
* (`null`). Clip mode, a challenge issued by `screenRamp()`. CHROME-only: the host paints, the engine stamps the
|
|
469
|
+
* clip timeline. */
|
|
470
|
+
ramp: {
|
|
471
|
+
colour: ScreenRampPaint;
|
|
472
|
+
};
|
|
328
473
|
}
|
|
329
474
|
type V3TelemetryEvent = {
|
|
330
475
|
type: "detector";
|
|
@@ -340,10 +485,44 @@ type V3TelemetryEvent = {
|
|
|
340
485
|
timeToGateMs: number;
|
|
341
486
|
degradeCount: number;
|
|
342
487
|
meanDetectMs: number;
|
|
343
|
-
}
|
|
488
|
+
}
|
|
489
|
+
/** The first take was short, unreadable or errored: the clip is recorded once more (clip-duration fix). */
|
|
490
|
+
| {
|
|
491
|
+
type: "clip_retake";
|
|
492
|
+
reason: "short" | "unreadable" | "error";
|
|
493
|
+
}
|
|
494
|
+
/** Where the attempt's gate time went (see gate-blocking.ts): per-reason
|
|
495
|
+
* blocked tick counts + ms, accepted ms, and the ACTIVE device class /
|
|
496
|
+
* cadence after any dynamic profile adjustment. `final` on the attempt's
|
|
497
|
+
* end (fired / error / retry / destroy); throttled snapshots before it. */
|
|
498
|
+
| ({
|
|
499
|
+
type: "gate";
|
|
500
|
+
final: boolean;
|
|
501
|
+
activeClass: DeviceClass;
|
|
502
|
+
cadenceHz: number;
|
|
503
|
+
} & GateBlockSummary) | {
|
|
344
504
|
type: "error";
|
|
345
505
|
kind: CaptureErrorKind;
|
|
346
506
|
fallbackReason?: string;
|
|
507
|
+
}
|
|
508
|
+
/** Keyframe ranking (SDK spec §4.8a; only when `rankKeyframes` is on): the
|
|
509
|
+
* rank numbers of every candidate (never an image), the chosen index, the
|
|
510
|
+
* index sharpness alone would have chosen, and the extra detector time. */
|
|
511
|
+
| {
|
|
512
|
+
type: "keyframe";
|
|
513
|
+
tier: Detector["tier"] | null;
|
|
514
|
+
chosen: number;
|
|
515
|
+
sharpest: number;
|
|
516
|
+
detectMs: number;
|
|
517
|
+
candidates: Array<{
|
|
518
|
+
face: boolean;
|
|
519
|
+
frontal: number;
|
|
520
|
+
yaw?: number;
|
|
521
|
+
roll?: number;
|
|
522
|
+
eyes?: number;
|
|
523
|
+
score: number;
|
|
524
|
+
sharpness: number;
|
|
525
|
+
}>;
|
|
347
526
|
};
|
|
348
527
|
interface KeyframeCandidate {
|
|
349
528
|
blob: Blob;
|
|
@@ -382,7 +561,13 @@ interface CaptureSessionV3Options {
|
|
|
382
561
|
createRecorder?: () => Pick<ClipRecorder, "record" | "stop">;
|
|
383
562
|
/** (navigator.mediaDevices.getUserMedia) */
|
|
384
563
|
getUserMedia?: (constraints: MediaStreamConstraints) => Promise<MediaStream>;
|
|
385
|
-
/** (
|
|
564
|
+
/** (navigator.mediaDevices.enumerateDevices, only when `getUserMedia` is not overridden) — the back lenses by id. */
|
|
565
|
+
enumerateDevices?: () => Promise<ReadonlyArray<{
|
|
566
|
+
deviceId: string;
|
|
567
|
+
label: string;
|
|
568
|
+
kind?: string;
|
|
569
|
+
}>>;
|
|
570
|
+
/** (canvas keyframe, mirrored on the front camera only, + downscaled Laplacian sharpness) */
|
|
386
571
|
captureKeyframe?: (video: HTMLVideoElement) => Promise<KeyframeCandidate>;
|
|
387
572
|
/** (downscaled face-crop sharpness/exposure via canvas) */
|
|
388
573
|
measureQuality?: (video: HTMLVideoElement, box: {
|
|
@@ -399,13 +584,33 @@ interface CaptureSessionV3Options {
|
|
|
399
584
|
* worker-side through WorkerDetectorProxy. Hosts own Worker construction
|
|
400
585
|
* (bundler-specific `new Worker(new URL(...))`). */
|
|
401
586
|
createWorker?: () => WorkerLike;
|
|
587
|
+
/** Keyframe ranking switch (SDK spec §4.8a; server tuning
|
|
588
|
+
* `capture.liveness.keyframe.rank`, default off): read when positioning
|
|
589
|
+
* starts (prefetches the lazy ranker) and again when the capture fires.
|
|
590
|
+
* Off → today's sharpest-of-N, byte for byte. */
|
|
591
|
+
rankKeyframes?: () => boolean;
|
|
592
|
+
/** Screen-ramp challenge (liveness v7 §4.4; server tuning `capture.liveness.screenRamp`): read once when the
|
|
593
|
+
* clip recording starts. A challenge → the engine emits `ramp` at each issued onset on the clip timeline and
|
|
594
|
+
* reports what it rendered in `artifacts.screenRamp`; `undefined` (older backends, assisted sessions, no host
|
|
595
|
+
* painting) → no ramp, no field. Photo mode never ramps. */
|
|
596
|
+
screenRamp?: () => ScreenRampChallenge | undefined;
|
|
402
597
|
/** INERT (Phase 3 escalation seam — see EscalationHook). Accepted and
|
|
403
598
|
* retained, never called in Phases 1–2. */
|
|
404
599
|
escalation?: EscalationHook;
|
|
600
|
+
/** Upright guard (spec 2026-10-28 §4.2): the device is a phone, so a landscape frame (videoWidth > videoHeight)
|
|
601
|
+
* holds the gate and drops a clip being recorded (or the keyframes of a photo-mode capture). Read at each attempt
|
|
602
|
+
* start. (detectFormFactor() === 'phone' — desktop webcams are landscape by nature, and a tablet may stand in
|
|
603
|
+
* landscape on a stand: neither is ever guarded) */
|
|
604
|
+
isPhone?: () => boolean;
|
|
405
605
|
/** (performance.now) */
|
|
406
606
|
now?: () => number;
|
|
407
607
|
}
|
|
408
608
|
type Handler<K extends keyof CaptureSessionV3Events> = (payload: CaptureSessionV3Events[K]) => void;
|
|
609
|
+
/** Per-start options (the public handle's `start({ facing })`). */
|
|
610
|
+
interface CaptureSessionV3StartOptions {
|
|
611
|
+
/** Camera for this attempt AND later retries; absent → keep the current one. */
|
|
612
|
+
facingMode?: "user" | "environment";
|
|
613
|
+
}
|
|
409
614
|
declare class CaptureSessionV3 {
|
|
410
615
|
private readonly options;
|
|
411
616
|
private readonly handlers;
|
|
@@ -419,17 +624,37 @@ declare class CaptureSessionV3 {
|
|
|
419
624
|
private profiler;
|
|
420
625
|
private lastGuidanceKey;
|
|
421
626
|
private positioningStartedAt;
|
|
627
|
+
private cameraRequestedAt;
|
|
628
|
+
private cameraReadyAt;
|
|
629
|
+
private faceAcquiredAt;
|
|
630
|
+
private captureCompleteAt;
|
|
422
631
|
private fired;
|
|
423
632
|
private carriedDegrade;
|
|
424
633
|
private carriedMeans;
|
|
634
|
+
private blockStats;
|
|
635
|
+
private lastGateSnapshotAt;
|
|
636
|
+
/** The upright guard applies to this attempt (a phone). */
|
|
637
|
+
private uprightGuard;
|
|
638
|
+
/** Liveness v7 §4.5 item 2: the attempt's video track described right after getUserMedia (null: no track). */
|
|
639
|
+
private trackProvenance;
|
|
640
|
+
/** The ramp of the clip being recorded (stopped with the recording, the attempt or the session). */
|
|
641
|
+
private ramp;
|
|
425
642
|
constructor(options: CaptureSessionV3Options);
|
|
426
643
|
get state(): CaptureState;
|
|
427
644
|
on<K extends keyof CaptureSessionV3Events>(event: K, handler: Handler<K>): () => void;
|
|
428
645
|
private emit;
|
|
429
|
-
start(): Promise<void>;
|
|
646
|
+
start(options?: CaptureSessionV3StartOptions): Promise<void>;
|
|
647
|
+
/** The camera of the current attempt: the one its track reports once the stream is live, else the requested one
|
|
648
|
+
* (start option, switchCamera toggles). */
|
|
649
|
+
get facingMode(): "user" | "environment";
|
|
430
650
|
/** Full reset + camera restart — the documented recovery path (v1 parity). */
|
|
431
651
|
retry(): void;
|
|
432
652
|
switchCamera(): void;
|
|
653
|
+
/**
|
|
654
|
+
* Spec 2026-11-06 §3.3 (the capture mode switch): drop the running attempt (a recording is discarded, never
|
|
655
|
+
* finalized) and start again on `facingMode`.
|
|
656
|
+
*/
|
|
657
|
+
restart(facingMode: "user" | "environment"): void;
|
|
433
658
|
destroy(): void;
|
|
434
659
|
private run;
|
|
435
660
|
/** Chrome hint (Task 11): 'reduced' on LOW even without the media query. */
|
|
@@ -437,10 +662,29 @@ declare class CaptureSessionV3 {
|
|
|
437
662
|
private startScheduler;
|
|
438
663
|
private detectTick;
|
|
439
664
|
private fire;
|
|
440
|
-
/**
|
|
665
|
+
/**
|
|
666
|
+
* One recording of `windowMs` on the preview's frame clock, with the screen ramp (when issued) and the upright
|
|
667
|
+
* guard; rejects with the recorder's error. `onStopped` fires the moment the recording ends (before finalize).
|
|
668
|
+
*/
|
|
669
|
+
private recordTake;
|
|
670
|
+
/** `{ provenance }` from the live track's description, the recording's frame statistics and the painter flag; `{}` without a track. */
|
|
671
|
+
private provenance;
|
|
672
|
+
/** A phone showing a landscape frame: the guard holds the gate. */
|
|
673
|
+
private isLandscape;
|
|
674
|
+
/** Positioning on a sideways phone: no detection, the gate restarts from zero and the coaching says why. */
|
|
675
|
+
private holdUpright;
|
|
676
|
+
/** While the clip records (or, `recorder` null, the photo-mode keyframes are taken): a rotation to landscape aborts
|
|
677
|
+
* it. Returns the unwatch function. */
|
|
678
|
+
private watchRotation;
|
|
679
|
+
/** Drop the clip being recorded (or the photo-mode keyframes being taken; same stream, same detector) and go back to
|
|
680
|
+
* positioning with the upright coaching. */
|
|
681
|
+
private abortRecording;
|
|
682
|
+
/** Up to KEYFRAME_CANDIDATES frames (mirrored on the front camera) over KEYFRAME_WINDOW_MS —
|
|
441
683
|
* sharpest wins (reuses frame-quality.sharpness via the capture seam). */
|
|
442
684
|
private collectKeyframes;
|
|
443
685
|
private finishCapture;
|
|
686
|
+
/** The attempt's capture-phase timing (whole ms, ≥ 0); undefined when no mark landed. */
|
|
687
|
+
private captureTiming;
|
|
444
688
|
private defaultKeyframe;
|
|
445
689
|
/** Reused downscale canvas — falls back to the raw video where canvas 2D
|
|
446
690
|
* is unavailable (jsdom) so tests and exotic hosts keep detecting. */
|
|
@@ -449,10 +693,12 @@ declare class CaptureSessionV3 {
|
|
|
449
693
|
private defaultQuality;
|
|
450
694
|
private centerSharpness;
|
|
451
695
|
private teardownAttempt;
|
|
696
|
+
/** Emit the attempt's gate breakdown; a final report closes it (exactly once). */
|
|
697
|
+
private reportGate;
|
|
452
698
|
private stopTracks;
|
|
453
699
|
private fail;
|
|
454
700
|
private setState;
|
|
455
701
|
private now;
|
|
456
702
|
}
|
|
457
703
|
|
|
458
|
-
export { V3_GATE_DEFAULTS as A,
|
|
704
|
+
export { V3_GATE_DEFAULTS as $, GateBlockStats as A, type GateBlockSummary as B, type CameraErrorKind as C, DEFAULT_CLIP_MIME as D, ENCODER_TAIL_MS as E, FRAME_POLL_MS as F, GATE_SNAPSHOT_MS as G, type GateChecks as H, HOLD_UPRIGHT_KEY as I, INSPECT_WAIT_MS as J, KEYFRAME_CANDIDATES as K, KEYFRAME_WINDOW_MS as L, MAX_CLIP_BYTES as M, MAX_OVERRUN_MS as N, MIME_CANDIDATES as O, PROVENANCE_WAIT_MS as P, STOP_GRACE_MS as Q, type V3GateFactor as R, SHORT_CLIP_TOLERANCE_MS as S, TIMESLICE_MS as T, UPRIGHT_WATCH_MS as U, type V3ChecksPayload as V, type V3GateQuality as W, type V3GateThresholds as X, type V3GateTick as Y, type V3GateTickInput as Z, type V3TelemetryEvent as _, CLIP_MS as a, VIDEO_BPS as a0, betterTake as a1, blockReasonOf as a2, buildLivenessV2FormData as a3, cameraPreflight as a4, classifyDevice as a5, extForMime as a6, isClipTooLarge as a7, isMediaRecorderSupported as a8, mapGetUserMediaError as a9, needsRetake as aa, pickMimeType as ab, probeDevice as ac, type EngineErrorDetail as ad, type CaptureArtifacts as b, type CaptureErrorKind as c, type CaptureSessionEvents as d, CaptureSessionV3 as e, type CaptureSessionV3Events as f, type CaptureSessionV3Options as g, type CaptureSessionV3StartOptions as h, type CaptureState as i, type CaptureTiming as j, ClipError as k, type ClipErrorKind as l, ClipRecorder as m, type ClipRecorderOptions as n, type ClipResult as o, DEVICE_PROFILES as p, type DeviceClass as q, type DeviceProbe as r, type DeviceProfile as s, DeviceProfiler as t, type EscalationClipArtifact as u, type EscalationHook as v, FaceGateV3 as w, type FrameClock as x, type GateBlockEntry as y, type GateBlockReason as z };
|