@sekyro/web 0.1.0-rc.4 → 0.1.0-rc.5
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 +20 -0
- package/README.md +44 -0
- package/dist/{capture-session-v3-uXJr1Wlm.d.ts → capture-session-v3-Okq0EQHG.d.ts} +9 -2
- package/dist/{capture-session-v3-DEInCOUg.d.cts → capture-session-v3-UQU_WjO2.d.cts} +9 -2
- package/dist/{chunk-TBANUT3X.js → chunk-SGDXLAXR.js} +286 -8
- package/dist/chunk-SGDXLAXR.js.map +1 -0
- package/dist/{chunk-EWRNPKTR.js → chunk-TG5IE552.js} +7 -2
- package/dist/{chunk-EWRNPKTR.js.map → chunk-TG5IE552.js.map} +1 -1
- package/dist/core/index.cjs +6 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/{create-verification-Dkb2tXuY.d.cts → create-verification-CA-3szPI.d.cts} +84 -7
- package/dist/{create-verification-Ce1y5kJR.d.ts → create-verification-c98uAxbl.d.ts} +84 -7
- package/dist/index.cjs +331 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -2
- package/dist/index.d.ts +24 -2
- package/dist/index.js +61 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/index.cjs +208 -7
- package/dist/internal/index.cjs.map +1 -1
- package/dist/internal/index.d.cts +3 -3
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.js +12 -2
- package/dist/internal/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-TBANUT3X.js.map +0 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CameraErrorKind } from '../capture-session-v3-
|
|
2
|
-
export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as
|
|
1
|
+
import { C as CameraErrorKind } from '../capture-session-v3-UQU_WjO2.cjs';
|
|
2
|
+
export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GateChecks, K as KEYFRAME_CANDIDATES, u as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, v as MIME_CANDIDATES, S as STOP_GRACE_MS, T as TIMESLICE_MS, V as V3ChecksPayload, w as V3GateFactor, x as V3GateQuality, y as V3GateThresholds, z as V3GateTick, A as V3GateTickInput, B as V3TelemetryEvent, H as V3_GATE_DEFAULTS, I as VIDEO_BPS, J as buildLivenessV2FormData, L as cameraPreflight, N as classifyDevice, O as extForMime, P as isClipTooLarge, Q as isMediaRecorderSupported, R as mapGetUserMediaError, U as pickMimeType, W as probeDevice } from '../capture-session-v3-UQU_WjO2.cjs';
|
|
3
3
|
export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, I as IN_CIRCLE_FACTOR, b as buildCaptureConstraints, d as detectIsMobile } from '../capture-constraints-BujkZcfb.cjs';
|
|
4
4
|
export { C as CreateDetectorOptions, D as DEFAULT_TIER_ORDER, a as DEFAULT_V3_ASSET_BASE_URL, b as Detector, c as DetectorLadderError, F as FaceObservation, d as createDetector, i as intrinsicSize, t as toStreamPixels } from '../detect-worker-CKXHlXx9.cjs';
|
|
5
5
|
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CameraErrorKind } from '../capture-session-v3-
|
|
2
|
-
export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as
|
|
1
|
+
import { C as CameraErrorKind } from '../capture-session-v3-Okq0EQHG.js';
|
|
2
|
+
export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GateChecks, K as KEYFRAME_CANDIDATES, u as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, v as MIME_CANDIDATES, S as STOP_GRACE_MS, T as TIMESLICE_MS, V as V3ChecksPayload, w as V3GateFactor, x as V3GateQuality, y as V3GateThresholds, z as V3GateTick, A as V3GateTickInput, B as V3TelemetryEvent, H as V3_GATE_DEFAULTS, I as VIDEO_BPS, J as buildLivenessV2FormData, L as cameraPreflight, N as classifyDevice, O as extForMime, P as isClipTooLarge, Q as isMediaRecorderSupported, R as mapGetUserMediaError, U as pickMimeType, W as probeDevice } from '../capture-session-v3-Okq0EQHG.js';
|
|
3
3
|
export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, I as IN_CIRCLE_FACTOR, b as buildCaptureConstraints, d as detectIsMobile } from '../capture-constraints-BujkZcfb.js';
|
|
4
4
|
export { C as CreateDetectorOptions, D as DEFAULT_TIER_ORDER, a as DEFAULT_V3_ASSET_BASE_URL, b as Detector, c as DetectorLadderError, F as FaceObservation, d as createDetector, i as intrinsicSize, t as toStreamPixels } from '../detect-worker-CKXHlXx9.js';
|
|
5
5
|
|
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as Detector } from './detect-worker-CKXHlXx9.cjs';
|
|
2
|
+
import { i as CaptureState$1, f as CaptureSessionV3Events, g as CaptureSessionV3Options, c as CaptureErrorKind$1 } from './capture-session-v3-UQU_WjO2.cjs';
|
|
2
3
|
import { C as CheckReason, c as HostedSessionView, g as HostedClient, A as AttestationInput, h as SessionView, b as CheckType } from './hosted-client-DWzCRYJK.cjs';
|
|
3
4
|
|
|
4
5
|
/** Gate guidance code. `'hold'` is emitted while the clip records. */
|
|
@@ -110,14 +111,28 @@ interface LivenessCaptureEvents {
|
|
|
110
111
|
animations: "full" | "reduced";
|
|
111
112
|
};
|
|
112
113
|
}
|
|
114
|
+
/** Which camera to open: the selfie camera (`'user'`) or the rear one (`'environment'`). */
|
|
115
|
+
type CameraFacing = "user" | "environment";
|
|
116
|
+
/** Options of {@link LivenessCaptureHandle.start}. */
|
|
117
|
+
interface LivenessStartOptions {
|
|
118
|
+
/**
|
|
119
|
+
* Camera for this attempt and its retries; default: the current one
|
|
120
|
+
* ({@link LivenessCaptureOptions.facing}, else `'user'`). Use `switchCamera()`
|
|
121
|
+
* to change camera mid-capture.
|
|
122
|
+
*/
|
|
123
|
+
facing?: CameraFacing;
|
|
124
|
+
}
|
|
113
125
|
/** Live capture handle returned by {@link createLivenessCapture} / {@link Verification.liveness}. */
|
|
114
126
|
interface LivenessCaptureHandle {
|
|
115
127
|
/** Current {@link CaptureState}. */
|
|
116
128
|
readonly state: CaptureState;
|
|
117
129
|
/** Subscribe; returns the unsubscribe function. */
|
|
118
130
|
on<K extends keyof LivenessCaptureEvents>(event: K, handler: (payload: LivenessCaptureEvents[K]) => void): () => void;
|
|
119
|
-
/**
|
|
120
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Ask for the camera and start gating. Resolves once the attempt is running or failed.
|
|
133
|
+
* `options.facing` picks the camera for this attempt and later retries.
|
|
134
|
+
*/
|
|
135
|
+
start(options?: LivenessStartOptions): Promise<void>;
|
|
121
136
|
/** Fresh attempt: resets the engine and restarts the camera. */
|
|
122
137
|
retry(): void;
|
|
123
138
|
/** Toggle user/environment camera (gate restarts from zero). */
|
|
@@ -129,10 +144,18 @@ interface LivenessCaptureHandle {
|
|
|
129
144
|
interface LivenessCaptureOptions {
|
|
130
145
|
/** Host-owned `<video playsInline muted>` element. */
|
|
131
146
|
video: HTMLVideoElement;
|
|
132
|
-
/** Initial camera; default `'user'`. */
|
|
133
|
-
facing?:
|
|
147
|
+
/** Initial camera; default `'user'`. `start({ facing })` overrides it. */
|
|
148
|
+
facing?: CameraFacing;
|
|
134
149
|
/** Base URL of the detector assets (tasks-vision wasm + tflite); default `/models-v3`. */
|
|
135
150
|
assetBaseUrl?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Hold a Screen Wake Lock while the camera is live (`starting` / `gating` /
|
|
153
|
+
* `recording`) so the phone does not dim or lock mid-capture; re-taken when
|
|
154
|
+
* the page becomes visible again. Best-effort: unsupported browsers or a
|
|
155
|
+
* refused request (e.g. an iframe without `allow="screen-wake-lock"`) never
|
|
156
|
+
* affect the capture. Default `true`; `false` never requests the lock.
|
|
157
|
+
*/
|
|
158
|
+
keepScreenAwake?: boolean;
|
|
136
159
|
}
|
|
137
160
|
/**
|
|
138
161
|
* SDK-side failure reasons (status `'unavailable'`):
|
|
@@ -218,7 +241,10 @@ interface Verification {
|
|
|
218
241
|
interface CaptureEngine {
|
|
219
242
|
readonly state: CaptureState$1;
|
|
220
243
|
on<K extends keyof CaptureSessionV3Events>(event: K, handler: (payload: CaptureSessionV3Events[K]) => void): () => void;
|
|
221
|
-
|
|
244
|
+
/** `facingMode` sets the camera for this attempt and later retries. */
|
|
245
|
+
start(options?: {
|
|
246
|
+
facingMode?: "user" | "environment";
|
|
247
|
+
}): Promise<void>;
|
|
222
248
|
retry(): void;
|
|
223
249
|
switchCamera(): void;
|
|
224
250
|
destroy(): void;
|
|
@@ -253,6 +279,57 @@ declare function createLivenessCaptureInternal(options: LivenessCaptureOptions,
|
|
|
253
279
|
*/
|
|
254
280
|
declare function createLivenessCapture(options: LivenessCaptureOptions): LivenessCaptureHandle;
|
|
255
281
|
|
|
282
|
+
/** Preload state per asset base URL. */
|
|
283
|
+
type LivenessAssetsStatus = "idle" | "loading" | "ready" | "failed";
|
|
284
|
+
/** Options of {@link preloadLivenessAssets}. */
|
|
285
|
+
interface PreloadLivenessAssetsOptions {
|
|
286
|
+
/** Same value as the capture's `assetBaseUrl`; default `/models-v3`. */
|
|
287
|
+
assetBaseUrl?: string;
|
|
288
|
+
/** Defer the load to browser idle time (`requestIdleCallback`, 1.2 s timeout fallback). Default `false`. */
|
|
289
|
+
idle?: boolean;
|
|
290
|
+
/** Skip when the browser asks to save data (`navigator.connection.saveData`). Default `false`. */
|
|
291
|
+
respectSaveData?: boolean;
|
|
292
|
+
}
|
|
293
|
+
/** Blaze init deadline for the preload — generous: a slow ~11 MB wasm download must finish. */
|
|
294
|
+
declare const PRELOAD_BLAZE_INIT_TIMEOUT_MS = 120000;
|
|
295
|
+
/** Outer budget reclaiming only a genuinely hung load (≥ the init deadline + slack). */
|
|
296
|
+
declare const PRELOAD_BUDGET_MS = 130000;
|
|
297
|
+
type Loader = (base: string) => Promise<Detector>;
|
|
298
|
+
/** @internal Test seam: replace the detector loader (null restores the real one). */
|
|
299
|
+
declare function setPreloadLoaderForTests(next: Loader | null): void;
|
|
300
|
+
/** @internal Test seam: drop every entry (destroying warmed detectors). */
|
|
301
|
+
declare function resetLivenessAssetsForTests(): void;
|
|
302
|
+
/**
|
|
303
|
+
* Warm the face detector for `assetBaseUrl` so the capture starts instantly.
|
|
304
|
+
* Idempotent per base URL and never rejects: resolves the settled status.
|
|
305
|
+
* `'idle'` means nothing was preloaded here (SSR, no camera API, Data-Saver
|
|
306
|
+
* skip) — start normally. Calling again after `'failed'` retries the load.
|
|
307
|
+
* With `idle: true` the load is deferred (status stays `'idle'` until it
|
|
308
|
+
* starts); a later non-idle call — or a capture mounting meanwhile — starts it
|
|
309
|
+
* at once, and {@link releaseLivenessAssets} cancels it.
|
|
310
|
+
*/
|
|
311
|
+
declare function preloadLivenessAssets(options?: PreloadLivenessAssetsOptions): Promise<LivenessAssetsStatus>;
|
|
312
|
+
/** Current preload status for `assetBaseUrl` (default `/models-v3`). */
|
|
313
|
+
declare function getLivenessAssetsStatus(assetBaseUrl?: string): LivenessAssetsStatus;
|
|
314
|
+
/**
|
|
315
|
+
* Subscribe to status changes for `assetBaseUrl`; returns the unsubscribe
|
|
316
|
+
* function. Does NOT emit the current status on subscribe (read it with
|
|
317
|
+
* {@link getLivenessAssetsStatus}) — the
|
|
318
|
+
* `useSyncExternalStore(subscribe, getSnapshot)` contract, so it plugs into
|
|
319
|
+
* that hook directly.
|
|
320
|
+
*/
|
|
321
|
+
declare function subscribeLivenessAssets(listener: (status: LivenessAssetsStatus) => void, assetBaseUrl?: string): () => void;
|
|
322
|
+
/** Free the warmed detector (an SPA leaving the flow). Never call while a capture is mounted. */
|
|
323
|
+
declare function releaseLivenessAssets(assetBaseUrl?: string): void;
|
|
324
|
+
/**
|
|
325
|
+
* @internal The capture engine's detector source when a preload exists for
|
|
326
|
+
* `assetBaseUrl`: a non-owning view of the warm instance (waiting for an
|
|
327
|
+
* in-flight load), or — once that load failed — a cold detector OWNED by the
|
|
328
|
+
* session (default ladder + deadline). `undefined` when nothing was preloaded.
|
|
329
|
+
* Invoking it on an idle-scheduled preload starts that load now and joins it.
|
|
330
|
+
*/
|
|
331
|
+
declare function preloadedDetectorFactory(assetBaseUrl?: string): (() => Promise<Detector>) | undefined;
|
|
332
|
+
|
|
256
333
|
/** The client surface the flow needs — `HostedClient` or a test fake. */
|
|
257
334
|
type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "presign" | "uploadToSpaces" | "completeMedia" | "submitCheck">;
|
|
258
335
|
/** The presign policy allowlist for `kind: 'clip'` (media.policy.ts mirror). */
|
|
@@ -368,4 +445,4 @@ declare function createVerification(options: VerificationOptions): Verification;
|
|
|
368
445
|
/** {@link createVerification} with construction seams (tests / Sekyro-internal hosts). */
|
|
369
446
|
declare function createVerificationInternal(options: VerificationOptions, internals: VerificationInternals): Verification;
|
|
370
447
|
|
|
371
|
-
export { AttestationError as A, type
|
|
448
|
+
export { preloadedDetectorFactory as $, AttestationError as A, type LivenessFlowDeps as B, type CameraFacing as C, DEFAULT_API_ORIGIN as D, type LivenessFlowOutcome as E, PRELOAD_BLAZE_INIT_TIMEOUT_MS as F, type GateHint as G, type HostedClientLike as H, PRELOAD_BUDGET_MS as I, PROCESSING_POLL_DELAY_MS as J, PROCESSING_POLL_MAX as K, type LivenessAssetsStatus as L, REGISTRY_RETRY_DELAY_MS as M, type SubmitExecutor as N, type SubmitRuntime as O, type PreloadLivenessAssetsOptions as P, TRANSPORT_REPLAY_DELAY_MS as Q, type ReasonCode as R, type SdkFailureReason as S, TRANSPORT_REPLAY_ATTEMPTS as T, type VerificationInternals as U, type Verification as V, createLivenessCaptureInternal as W, createVerificationInternal as X, mapEngineState as Y, mapErrorKind as Z, mapGuidanceHint as _, type CaptureChannel as a, randomUuid as a0, resetLivenessAssetsForTests as a1, runLivenessFlow as a2, runSubmission as a3, setPreloadLoaderForTests as a4, type CaptureEngineId as b, type CaptureError as c, type CaptureErrorKind as d, type CaptureState as e, type CapturedArtifacts as f, type GateUpdate as g, type LivenessCaptureEvents as h, type LivenessCaptureHandle as i, type LivenessCaptureOptions as j, type LivenessStartOptions as k, type VerificationEvents as l, type VerificationLocale as m, type VerificationOptions as n, type VerificationResult as o, type VerificationStatus as p, createLivenessCapture as q, createVerification as r, getLivenessAssetsStatus as s, preloadLivenessAssets as t, releaseLivenessAssets as u, subscribeLivenessAssets as v, CLIP_MIME_ALLOWLIST as w, type CaptureEngine as x, type LivenessCaptureInternalHandle as y, type LivenessCaptureInternals as z };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as Detector } from './detect-worker-CKXHlXx9.js';
|
|
2
|
+
import { i as CaptureState$1, f as CaptureSessionV3Events, g as CaptureSessionV3Options, c as CaptureErrorKind$1 } from './capture-session-v3-Okq0EQHG.js';
|
|
2
3
|
import { C as CheckReason, c as HostedSessionView, g as HostedClient, A as AttestationInput, h as SessionView, b as CheckType } from './hosted-client-DWzCRYJK.js';
|
|
3
4
|
|
|
4
5
|
/** Gate guidance code. `'hold'` is emitted while the clip records. */
|
|
@@ -110,14 +111,28 @@ interface LivenessCaptureEvents {
|
|
|
110
111
|
animations: "full" | "reduced";
|
|
111
112
|
};
|
|
112
113
|
}
|
|
114
|
+
/** Which camera to open: the selfie camera (`'user'`) or the rear one (`'environment'`). */
|
|
115
|
+
type CameraFacing = "user" | "environment";
|
|
116
|
+
/** Options of {@link LivenessCaptureHandle.start}. */
|
|
117
|
+
interface LivenessStartOptions {
|
|
118
|
+
/**
|
|
119
|
+
* Camera for this attempt and its retries; default: the current one
|
|
120
|
+
* ({@link LivenessCaptureOptions.facing}, else `'user'`). Use `switchCamera()`
|
|
121
|
+
* to change camera mid-capture.
|
|
122
|
+
*/
|
|
123
|
+
facing?: CameraFacing;
|
|
124
|
+
}
|
|
113
125
|
/** Live capture handle returned by {@link createLivenessCapture} / {@link Verification.liveness}. */
|
|
114
126
|
interface LivenessCaptureHandle {
|
|
115
127
|
/** Current {@link CaptureState}. */
|
|
116
128
|
readonly state: CaptureState;
|
|
117
129
|
/** Subscribe; returns the unsubscribe function. */
|
|
118
130
|
on<K extends keyof LivenessCaptureEvents>(event: K, handler: (payload: LivenessCaptureEvents[K]) => void): () => void;
|
|
119
|
-
/**
|
|
120
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Ask for the camera and start gating. Resolves once the attempt is running or failed.
|
|
133
|
+
* `options.facing` picks the camera for this attempt and later retries.
|
|
134
|
+
*/
|
|
135
|
+
start(options?: LivenessStartOptions): Promise<void>;
|
|
121
136
|
/** Fresh attempt: resets the engine and restarts the camera. */
|
|
122
137
|
retry(): void;
|
|
123
138
|
/** Toggle user/environment camera (gate restarts from zero). */
|
|
@@ -129,10 +144,18 @@ interface LivenessCaptureHandle {
|
|
|
129
144
|
interface LivenessCaptureOptions {
|
|
130
145
|
/** Host-owned `<video playsInline muted>` element. */
|
|
131
146
|
video: HTMLVideoElement;
|
|
132
|
-
/** Initial camera; default `'user'`. */
|
|
133
|
-
facing?:
|
|
147
|
+
/** Initial camera; default `'user'`. `start({ facing })` overrides it. */
|
|
148
|
+
facing?: CameraFacing;
|
|
134
149
|
/** Base URL of the detector assets (tasks-vision wasm + tflite); default `/models-v3`. */
|
|
135
150
|
assetBaseUrl?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Hold a Screen Wake Lock while the camera is live (`starting` / `gating` /
|
|
153
|
+
* `recording`) so the phone does not dim or lock mid-capture; re-taken when
|
|
154
|
+
* the page becomes visible again. Best-effort: unsupported browsers or a
|
|
155
|
+
* refused request (e.g. an iframe without `allow="screen-wake-lock"`) never
|
|
156
|
+
* affect the capture. Default `true`; `false` never requests the lock.
|
|
157
|
+
*/
|
|
158
|
+
keepScreenAwake?: boolean;
|
|
136
159
|
}
|
|
137
160
|
/**
|
|
138
161
|
* SDK-side failure reasons (status `'unavailable'`):
|
|
@@ -218,7 +241,10 @@ interface Verification {
|
|
|
218
241
|
interface CaptureEngine {
|
|
219
242
|
readonly state: CaptureState$1;
|
|
220
243
|
on<K extends keyof CaptureSessionV3Events>(event: K, handler: (payload: CaptureSessionV3Events[K]) => void): () => void;
|
|
221
|
-
|
|
244
|
+
/** `facingMode` sets the camera for this attempt and later retries. */
|
|
245
|
+
start(options?: {
|
|
246
|
+
facingMode?: "user" | "environment";
|
|
247
|
+
}): Promise<void>;
|
|
222
248
|
retry(): void;
|
|
223
249
|
switchCamera(): void;
|
|
224
250
|
destroy(): void;
|
|
@@ -253,6 +279,57 @@ declare function createLivenessCaptureInternal(options: LivenessCaptureOptions,
|
|
|
253
279
|
*/
|
|
254
280
|
declare function createLivenessCapture(options: LivenessCaptureOptions): LivenessCaptureHandle;
|
|
255
281
|
|
|
282
|
+
/** Preload state per asset base URL. */
|
|
283
|
+
type LivenessAssetsStatus = "idle" | "loading" | "ready" | "failed";
|
|
284
|
+
/** Options of {@link preloadLivenessAssets}. */
|
|
285
|
+
interface PreloadLivenessAssetsOptions {
|
|
286
|
+
/** Same value as the capture's `assetBaseUrl`; default `/models-v3`. */
|
|
287
|
+
assetBaseUrl?: string;
|
|
288
|
+
/** Defer the load to browser idle time (`requestIdleCallback`, 1.2 s timeout fallback). Default `false`. */
|
|
289
|
+
idle?: boolean;
|
|
290
|
+
/** Skip when the browser asks to save data (`navigator.connection.saveData`). Default `false`. */
|
|
291
|
+
respectSaveData?: boolean;
|
|
292
|
+
}
|
|
293
|
+
/** Blaze init deadline for the preload — generous: a slow ~11 MB wasm download must finish. */
|
|
294
|
+
declare const PRELOAD_BLAZE_INIT_TIMEOUT_MS = 120000;
|
|
295
|
+
/** Outer budget reclaiming only a genuinely hung load (≥ the init deadline + slack). */
|
|
296
|
+
declare const PRELOAD_BUDGET_MS = 130000;
|
|
297
|
+
type Loader = (base: string) => Promise<Detector>;
|
|
298
|
+
/** @internal Test seam: replace the detector loader (null restores the real one). */
|
|
299
|
+
declare function setPreloadLoaderForTests(next: Loader | null): void;
|
|
300
|
+
/** @internal Test seam: drop every entry (destroying warmed detectors). */
|
|
301
|
+
declare function resetLivenessAssetsForTests(): void;
|
|
302
|
+
/**
|
|
303
|
+
* Warm the face detector for `assetBaseUrl` so the capture starts instantly.
|
|
304
|
+
* Idempotent per base URL and never rejects: resolves the settled status.
|
|
305
|
+
* `'idle'` means nothing was preloaded here (SSR, no camera API, Data-Saver
|
|
306
|
+
* skip) — start normally. Calling again after `'failed'` retries the load.
|
|
307
|
+
* With `idle: true` the load is deferred (status stays `'idle'` until it
|
|
308
|
+
* starts); a later non-idle call — or a capture mounting meanwhile — starts it
|
|
309
|
+
* at once, and {@link releaseLivenessAssets} cancels it.
|
|
310
|
+
*/
|
|
311
|
+
declare function preloadLivenessAssets(options?: PreloadLivenessAssetsOptions): Promise<LivenessAssetsStatus>;
|
|
312
|
+
/** Current preload status for `assetBaseUrl` (default `/models-v3`). */
|
|
313
|
+
declare function getLivenessAssetsStatus(assetBaseUrl?: string): LivenessAssetsStatus;
|
|
314
|
+
/**
|
|
315
|
+
* Subscribe to status changes for `assetBaseUrl`; returns the unsubscribe
|
|
316
|
+
* function. Does NOT emit the current status on subscribe (read it with
|
|
317
|
+
* {@link getLivenessAssetsStatus}) — the
|
|
318
|
+
* `useSyncExternalStore(subscribe, getSnapshot)` contract, so it plugs into
|
|
319
|
+
* that hook directly.
|
|
320
|
+
*/
|
|
321
|
+
declare function subscribeLivenessAssets(listener: (status: LivenessAssetsStatus) => void, assetBaseUrl?: string): () => void;
|
|
322
|
+
/** Free the warmed detector (an SPA leaving the flow). Never call while a capture is mounted. */
|
|
323
|
+
declare function releaseLivenessAssets(assetBaseUrl?: string): void;
|
|
324
|
+
/**
|
|
325
|
+
* @internal The capture engine's detector source when a preload exists for
|
|
326
|
+
* `assetBaseUrl`: a non-owning view of the warm instance (waiting for an
|
|
327
|
+
* in-flight load), or — once that load failed — a cold detector OWNED by the
|
|
328
|
+
* session (default ladder + deadline). `undefined` when nothing was preloaded.
|
|
329
|
+
* Invoking it on an idle-scheduled preload starts that load now and joins it.
|
|
330
|
+
*/
|
|
331
|
+
declare function preloadedDetectorFactory(assetBaseUrl?: string): (() => Promise<Detector>) | undefined;
|
|
332
|
+
|
|
256
333
|
/** The client surface the flow needs — `HostedClient` or a test fake. */
|
|
257
334
|
type HostedClientLike = Pick<HostedClient, "getSession" | "recordConsent" | "presign" | "uploadToSpaces" | "completeMedia" | "submitCheck">;
|
|
258
335
|
/** The presign policy allowlist for `kind: 'clip'` (media.policy.ts mirror). */
|
|
@@ -368,4 +445,4 @@ declare function createVerification(options: VerificationOptions): Verification;
|
|
|
368
445
|
/** {@link createVerification} with construction seams (tests / Sekyro-internal hosts). */
|
|
369
446
|
declare function createVerificationInternal(options: VerificationOptions, internals: VerificationInternals): Verification;
|
|
370
447
|
|
|
371
|
-
export { AttestationError as A, type
|
|
448
|
+
export { preloadedDetectorFactory as $, AttestationError as A, type LivenessFlowDeps as B, type CameraFacing as C, DEFAULT_API_ORIGIN as D, type LivenessFlowOutcome as E, PRELOAD_BLAZE_INIT_TIMEOUT_MS as F, type GateHint as G, type HostedClientLike as H, PRELOAD_BUDGET_MS as I, PROCESSING_POLL_DELAY_MS as J, PROCESSING_POLL_MAX as K, type LivenessAssetsStatus as L, REGISTRY_RETRY_DELAY_MS as M, type SubmitExecutor as N, type SubmitRuntime as O, type PreloadLivenessAssetsOptions as P, TRANSPORT_REPLAY_DELAY_MS as Q, type ReasonCode as R, type SdkFailureReason as S, TRANSPORT_REPLAY_ATTEMPTS as T, type VerificationInternals as U, type Verification as V, createLivenessCaptureInternal as W, createVerificationInternal as X, mapEngineState as Y, mapErrorKind as Z, mapGuidanceHint as _, type CaptureChannel as a, randomUuid as a0, resetLivenessAssetsForTests as a1, runLivenessFlow as a2, runSubmission as a3, setPreloadLoaderForTests as a4, type CaptureEngineId as b, type CaptureError as c, type CaptureErrorKind as d, type CaptureState as e, type CapturedArtifacts as f, type GateUpdate as g, type LivenessCaptureEvents as h, type LivenessCaptureHandle as i, type LivenessCaptureOptions as j, type LivenessStartOptions as k, type VerificationEvents as l, type VerificationLocale as m, type VerificationOptions as n, type VerificationResult as o, type VerificationStatus as p, createLivenessCapture as q, createVerification as r, getLivenessAssetsStatus as s, preloadLivenessAssets as t, releaseLivenessAssets as u, subscribeLivenessAssets as v, CLIP_MIME_ALLOWLIST as w, type CaptureEngine as x, type LivenessCaptureInternalHandle as y, type LivenessCaptureInternals as z };
|