@sekyro/web 0.1.0-rc.10 → 0.1.0-rc.11
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 +12 -0
- package/dist/{capture-session-doc-GK6G7JOI.js → capture-session-doc-DMQ7T3HC.js} +1 -1
- package/dist/{capture-session-v3-CmJw_bK0.d.cts → capture-session-v3-CCHws1mz.d.cts} +34 -3
- package/dist/{capture-session-v3-DGG2stO6.d.ts → capture-session-v3-DYrhYJoM.d.ts} +34 -3
- package/dist/{chunk-SEC64KZ3.js → chunk-73M7LS4H.js} +1 -1
- package/dist/chunk-AHD4DA2V.js +1 -0
- package/dist/chunk-GT2ZLGF7.js +1 -0
- package/dist/chunk-HHCGQSD4.js +1 -0
- package/dist/chunk-IJLHPX35.js +1 -0
- package/dist/{chunk-FFDB6LQN.js → chunk-JDGEZ542.js} +1 -1
- package/dist/{chunk-BAGSM67V.js → chunk-LUKTHL6K.js} +1 -1
- package/dist/chunk-MXNZMTC2.js +1 -0
- package/dist/{chunk-UGMHAFEY.js → chunk-OWU22VXP.js} +1 -1
- package/dist/chunk-U6TYL2IJ.js +1 -0
- package/dist/chunk-URUKV6NC.js +1 -0
- package/dist/chunk-V5K2JLC7.js +1 -0
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +5 -3
- package/dist/client/index.d.ts +5 -3
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +3 -2
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.js +1 -1
- package/dist/{create-document-capture-IGUQP2NS.js → create-document-capture-FV4XGUKQ.js} +1 -1
- package/dist/{create-portrait-capture-RJSFY37D.js → create-portrait-capture-C462EIB6.js} +1 -1
- package/dist/{create-verification-Bb20j6zk.d.ts → create-verification-CmJzn7sq.d.ts} +81 -8
- package/dist/{create-verification-CtqF4A9W.d.cts → create-verification-CzLrQjeM.d.cts} +81 -8
- package/dist/icao-gate-BeznQECA.d.cts +500 -0
- package/dist/icao-gate-Bw5sQVlt.d.ts +500 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +1 -1
- package/dist/internal/index.cjs +1 -1
- package/dist/internal/index.d.cts +17 -8
- package/dist/internal/index.d.ts +17 -8
- package/dist/internal/index.js +1 -1
- package/dist/{plan-runner-QCK2SOGS.js → plan-runner-ZVAY4FSB.js} +1 -1
- package/dist/popup/index.cjs +1 -1
- package/dist/popup/index.d.cts +7 -1
- package/dist/popup/index.d.ts +7 -1
- package/dist/popup/index.js +1 -1
- package/dist/{icao-gate-terzKYD7.d.cts → types-BWyAHKt_.d.cts} +164 -499
- package/dist/{icao-gate-terzKYD7.d.ts → types-BWyAHKt_.d.ts} +164 -499
- package/package.json +1 -1
- package/sbom.cdx.json +7 -7
- package/dist/chunk-3MSUJYBO.js +0 -1
- package/dist/chunk-ETY6SAAZ.js +0 -1
- package/dist/chunk-HAO6EQTH.js +0 -1
- package/dist/chunk-HWAXEQD5.js +0 -1
- package/dist/chunk-SXZCL5NO.js +0 -1
- package/dist/chunk-SZ7YGNUZ.js +0 -1
- package/dist/chunk-WKJJEPWA.js +0 -1
- package/dist/chunk-XR64UFLK.js +0 -1
|
@@ -1,78 +1,3 @@
|
|
|
1
|
-
interface Point {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
}
|
|
5
|
-
interface Box {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
}
|
|
11
|
-
/** The face geometry the gate needs, in SOURCE (stream) pixels. */
|
|
12
|
-
interface FaceGeometry {
|
|
13
|
-
/** Eye centres, ordered by image x (`left` = smaller x). */
|
|
14
|
-
leftEye: Point;
|
|
15
|
-
rightEye: Point;
|
|
16
|
-
/** Inter-ocular distance (px). */
|
|
17
|
-
iod: number;
|
|
18
|
-
/** Bounding box of the landmark mesh (forehead to chin). */
|
|
19
|
-
box: Box;
|
|
20
|
-
/** Nose tip (landmark 1): splits the face into halves for the lighting ratio. */
|
|
21
|
-
nose: Point;
|
|
22
|
-
/** Eye-contour boxes (glare), same order as the eyes. */
|
|
23
|
-
leftEyeBox: Box;
|
|
24
|
-
rightEyeBox: Box;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Normalised Face Landmarker landmarks (0..1) → source-pixel geometry.
|
|
28
|
-
* `null` when the mesh is too short to carry the eyes.
|
|
29
|
-
*/
|
|
30
|
-
declare function faceGeometry(landmarks: readonly Point[], width: number, height: number): FaceGeometry | null;
|
|
31
|
-
interface HeadPose {
|
|
32
|
-
yaw: number;
|
|
33
|
-
pitch: number;
|
|
34
|
-
roll: number;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Yaw / pitch / roll (degrees) of the Face Landmarker's facial transformation
|
|
38
|
-
* matrix (4×4, `layout` of `data`; MediaPipe emits column-major). Rotation
|
|
39
|
-
* order R = Rz(roll)·Ry(yaw)·Rx(pitch): yaw turns about the vertical axis,
|
|
40
|
-
* pitch nods, roll tilts. Only magnitudes are gated, so sign conventions never
|
|
41
|
-
* change a verdict. `null` for a malformed matrix.
|
|
42
|
-
*/
|
|
43
|
-
declare function poseFromMatrix(data: readonly number[], layout?: "column" | "row"): HeadPose | null;
|
|
44
|
-
/** Roll from the eye line (degrees) — the fallback when no matrix is available. */
|
|
45
|
-
declare function eyeLineRoll(g: Pick<FaceGeometry, "leftEye" | "rightEye">): number;
|
|
46
|
-
/** The ICAO canvas (icao.py): 480×640, eye midpoint at x = 240, eye line at y = 289, IOD 120–160. */
|
|
47
|
-
declare const ICAO_CANVAS: {
|
|
48
|
-
readonly width: 480;
|
|
49
|
-
readonly height: 640;
|
|
50
|
-
readonly eyeX: 240;
|
|
51
|
-
readonly eyeY: 289;
|
|
52
|
-
readonly iodMin: 120;
|
|
53
|
-
readonly iodMax: 160;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* The source-pixel window the server's ICAO crop is cut from: scale 1 when the
|
|
57
|
-
* IOD already lies in 120–160, else the scale that brings it to 120 (icao.py:
|
|
58
|
-
* "120 when outside the band"), the eye midpoint at (240, 289) of the window.
|
|
59
|
-
*/
|
|
60
|
-
declare function icaoWindow(g: Pick<FaceGeometry, "leftEye" | "rightEye" | "iod">): Box;
|
|
61
|
-
/** How far a window spills outside the frame (0 = inside), as a fraction of its size. */
|
|
62
|
-
declare function windowOverflow(window: Box, frameWidth: number, frameHeight: number): number;
|
|
63
|
-
/**
|
|
64
|
-
* The region of the full-resolution still the SDK uploads: the ICAO window
|
|
65
|
-
* grown by `margin` about its centre (so the server re-crops with its own
|
|
66
|
-
* landmarks), at least `minWidth × minHeight`, 3:4 portrait, then fitted into
|
|
67
|
-
* the frame — the margin shrinks first, then the box slides inside, and only
|
|
68
|
-
* a window larger than the frame is cut to it. Integer pixels.
|
|
69
|
-
*/
|
|
70
|
-
declare function portraitCropRegion(g: Pick<FaceGeometry, "leftEye" | "rightEye" | "iod">, frameWidth: number, frameHeight: number, opts: {
|
|
71
|
-
margin: number;
|
|
72
|
-
minWidth: number;
|
|
73
|
-
minHeight: number;
|
|
74
|
-
}): Box;
|
|
75
|
-
|
|
76
1
|
/** Server-tunable thresholds (`capture.icao.backgroundCheck`); defaults below. */
|
|
77
2
|
interface BackgroundCheckTuning {
|
|
78
3
|
/** Run the check at all (ICAO on). Default `true`. */
|
|
@@ -318,6 +243,14 @@ declare function resolveIcaoTuning(raw: unknown, tuningVersion?: unknown): Resol
|
|
|
318
243
|
type SessionStatus = "created" | "in_progress" | "review_pending" | "completed" | "expired" | "failed";
|
|
319
244
|
/** Terminal verdict, orthogonal to `status`; `null` until terminal/review. */
|
|
320
245
|
type SessionOutcome = "approved" | "review" | "rejected";
|
|
246
|
+
/**
|
|
247
|
+
* What a finished session proved (spec 2026-10-29 §3.2): `1` a live, real
|
|
248
|
+
* person, `2` that person's identity, `3` an identity corroborated by an
|
|
249
|
+
* independent source; `0` on a rejected session.
|
|
250
|
+
*/
|
|
251
|
+
type VerificationLevel = 0 | 1 | 2 | 3;
|
|
252
|
+
/** How a session's {@link VerificationLevel} was proved (spec 2026-10-29 §3.4). */
|
|
253
|
+
type VerificationAssurance = "live_only" | "live_unique" | "document_biometric" | "chip_biometric" | "registry_biometric" | "supplied_biometric" | "eid_authenticated";
|
|
321
254
|
/** Per-check seven-state machine (spec §4.3). */
|
|
322
255
|
type CheckState = "pending" | "input_required" | "processing" | "passed" | "failed" | "review" | "skipped";
|
|
323
256
|
/**
|
|
@@ -327,7 +260,7 @@ type CheckState = "pending" | "input_required" | "processing" | "passed" | "fail
|
|
|
327
260
|
* `eid_auth` (SDK spec §3.2) is the national eID sign-in (Houwiyeti in MR).
|
|
328
261
|
*/
|
|
329
262
|
type CheckType = "liveness" | "face_match" | "doc_ocr" | "population_registry" | "phone_otp" | "nfc_chip" | "email_otp" | "portrait_icao" | "eid_auth";
|
|
330
|
-
type LivenessReason = "no_face" | "media_unreadable" | "clip_too_short" | "spoof_detected" | "review_band" | "liveness_inconclusive" | "device_integrity_failed" | "mobile_required" | "uncalibrated_capture_channel" | "capture_back_camera" | "capture_not_upright";
|
|
263
|
+
type LivenessReason = "no_face" | "media_unreadable" | "clip_too_short" | "spoof_detected" | "review_band" | "liveness_inconclusive" | "device_integrity_failed" | "mobile_required" | "uncalibrated_capture_channel" | "capture_back_camera" | "capture_not_upright" | "camera_unavailable";
|
|
331
264
|
type PopulationReason = "nni_not_found" | "nni_invalid" | "registry_unavailable" | "result_from_cache" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "nni_recheck";
|
|
332
265
|
type FaceMatchReason = "no_face_source" | "no_face_reference" | "low_quality_reference" | "below_threshold" | "review_band" | "match_inconclusive" | "subject_revoked" | "probe_not_from_liveness";
|
|
333
266
|
type DocReason = "side_missing" | "mrz_checksum_failed" | "unreadable" | "expired_document" | "authenticity_review" | "document_authenticity" | "registry_mismatch" | "document_nni_mismatch" | "nationality_unreadable" | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "name_mismatch" | "birth_date_mismatch" | "nationality_mismatch" | "document_number_mismatch";
|
|
@@ -353,14 +286,14 @@ type DecisionReason = "liveness_inconclusive" | "match_inconclusive" | "document
|
|
|
353
286
|
* `otp_expired` (code lapsed or no active send), `otp_send_failed` (the OTP
|
|
354
287
|
* service was unreachable / a send returned no token).
|
|
355
288
|
*/
|
|
356
|
-
type PhoneOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_channel_unavailable" | "otp_destination_not_allowed" | "otp_rate_limited" | "otp_destination_unknown";
|
|
289
|
+
type PhoneOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_channel_unavailable" | "otp_destination_not_allowed" | "otp_rate_limited" | "otp_destination_unknown" | "otp_daily_cap_reached";
|
|
357
290
|
/**
|
|
358
291
|
* email_otp reasons (Plan 8, profile v2 §4.6.5). All transient: a wrong or
|
|
359
292
|
* expired code, a send outage, too many sends, an address that cannot receive
|
|
360
293
|
* mail (`email_invalid`), or a disposable address the app blocks
|
|
361
294
|
* (`email_disposable`) — the person enters another address or resends.
|
|
362
295
|
*/
|
|
363
|
-
type EmailOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_rate_limited" | "email_invalid" | "email_disposable";
|
|
296
|
+
type EmailOtpReason = "otp_mismatch" | "otp_expired" | "otp_send_failed" | "otp_rate_limited" | "email_invalid" | "email_disposable" | "otp_daily_cap_reached";
|
|
364
297
|
/**
|
|
365
298
|
* nfc_chip reasons (M-nfc, SDK spec §4.3). Native SDKs read the chip; the web
|
|
366
299
|
* never does — on web the step arrives `skipped` (`platform_unsupported`) or
|
|
@@ -415,7 +348,12 @@ type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "cap
|
|
|
415
348
|
* `nationality_not_allowed`, `underage`, `age_unverifiable`,
|
|
416
349
|
* `document_nni_mismatch`).
|
|
417
350
|
*/
|
|
418
|
-
type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "document_nni_mismatch";
|
|
351
|
+
type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "document_nni_mismatch" | "camera_unavailable";
|
|
352
|
+
/**
|
|
353
|
+
* Why the person has no camera (spec 2026-10-29 §3.4, 2026-10-30): `denied` when the camera permission was refused,
|
|
354
|
+
* `no_camera` when there is no usable camera (none found, an insecure page or a browser that cannot capture).
|
|
355
|
+
*/
|
|
356
|
+
type CameraUnavailableCause = "denied" | "no_camera";
|
|
419
357
|
/**
|
|
420
358
|
* How the person proves their identity when the app makes the document
|
|
421
359
|
* optional for registry nationals (profile v2 step 3): type their national
|
|
@@ -708,6 +646,13 @@ interface NfcStepView {
|
|
|
708
646
|
source: "capture" | "document" | (string & {});
|
|
709
647
|
};
|
|
710
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* Liveness v7 §5.2: the retake hint's closed set (service `pipeline/retake_hint.py`, backend
|
|
651
|
+
* provenance picklist, copy keys `hints.*`): `appearance` (pad, deepfake, temporal signals),
|
|
652
|
+
* `motion` (no parallax or a high motion residual), `lighting` (low face luminance),
|
|
653
|
+
* `framing` (a small or clipped face box).
|
|
654
|
+
*/
|
|
655
|
+
type RetakeHint = "appearance" | "motion" | "lighting" | "framing";
|
|
711
656
|
/**
|
|
712
657
|
* Per-check projection in a {@link HostedSessionView} — the spec'd hosted step
|
|
713
658
|
* shape. NEVER carries `calibratedScore` or the raw check `outputs`; the only
|
|
@@ -719,6 +664,12 @@ interface HostedStepView {
|
|
|
719
664
|
state: CheckState;
|
|
720
665
|
/** Frozen-taxonomy reason code explaining a `failed`/`review` state. */
|
|
721
666
|
reason?: CheckReason;
|
|
667
|
+
/**
|
|
668
|
+
* Liveness v7 §5.2: what to change for the next capture, on a liveness step parked at
|
|
669
|
+
* `input_required` (the signal that weighed most in the inconclusive score). Absent on older
|
|
670
|
+
* APIs, on decisive results and on the other checks: then the reason's generic copy applies.
|
|
671
|
+
*/
|
|
672
|
+
retakeHint?: RetakeHint;
|
|
722
673
|
/**
|
|
723
674
|
* Spec 2026-10-27: a Sandbox check answered by simulation (no provider or
|
|
724
675
|
* model ran). Absent on Live, on real Sandbox checks and on older APIs.
|
|
@@ -817,6 +768,11 @@ interface HostedBranding {
|
|
|
817
768
|
radius?: "none" | "sm" | "md" | "lg" | "full";
|
|
818
769
|
/** Font choice (system fallbacks when the font is not installed). */
|
|
819
770
|
fontFamily?: "system" | "inter" | "ibm-plex-sans-arabic" | "noto-sans-arabic" | "roboto";
|
|
771
|
+
/**
|
|
772
|
+
* Spec 2026-10-29 D16: the org hides the "Verified by Sekyro AI" attribution (hosted frame and SDK footer).
|
|
773
|
+
* Present (true) only then; absent on older APIs.
|
|
774
|
+
*/
|
|
775
|
+
hideAttribution?: boolean;
|
|
820
776
|
}
|
|
821
777
|
/**
|
|
822
778
|
* Token-addressed hosted-page bootstrap (`GET /hosted/session`). A separate
|
|
@@ -832,7 +788,7 @@ interface HostedBranding {
|
|
|
832
788
|
*/
|
|
833
789
|
interface HostedCaptureTuning {
|
|
834
790
|
tuningVersion?: string;
|
|
835
|
-
liveness?:
|
|
791
|
+
liveness?: HostedLivenessCaptureTuning;
|
|
836
792
|
document?: Record<string, unknown>;
|
|
837
793
|
/** SDK spec §5.4 ID mode: the strict ICAO gate's coaching limits (present with `portrait`). */
|
|
838
794
|
icao?: IcaoCaptureTuning;
|
|
@@ -871,6 +827,91 @@ interface HostedLivePhotoTuning {
|
|
|
871
827
|
jpegQuality: number;
|
|
872
828
|
};
|
|
873
829
|
}
|
|
830
|
+
/**
|
|
831
|
+
* `capture.liveness`: the face gate's coaching values (open; web keeps its built-in v3 values) and, from liveness v7,
|
|
832
|
+
* the screen-ramp challenge the web SDK renders while the clip records.
|
|
833
|
+
*/
|
|
834
|
+
interface HostedLivenessCaptureTuning {
|
|
835
|
+
[field: string]: unknown;
|
|
836
|
+
/**
|
|
837
|
+
* Liveness v7 §4.4: the server-issued screen-ramp challenge of this session. Absent (older backends, assisted
|
|
838
|
+
* sessions, the ramp switched off): no ramp is rendered and the submit carries no `screenRamp`.
|
|
839
|
+
*/
|
|
840
|
+
screenRamp?: ScreenRampChallenge;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* The closed palette of the screen ramp (liveness v7 §4.4). Each name maps to one fixed sRGB value in `@sekyro/web`
|
|
844
|
+
* (`screenRampColourValue`); the service verifies the clip against the same values.
|
|
845
|
+
*/
|
|
846
|
+
type ScreenRampColour = 'rose' | 'peach' | 'sand' | 'mint' | 'sky' | 'lilac';
|
|
847
|
+
/**
|
|
848
|
+
* The screen-ramp challenge issued per session (liveness v7 §4.4, §4.5 item 1): three colours shown for 400 ms each,
|
|
849
|
+
* starting at `onsetsMs[i]` on the clip's own timeline (the backend jitters each onset inside its slot). The layer
|
|
850
|
+
* returns to transparent at 2,000 ms. The client renders exactly this and reports what it rendered
|
|
851
|
+
* ({@link ScreenRampReport}); the backend forwards the issued challenge to the model service.
|
|
852
|
+
*/
|
|
853
|
+
interface ScreenRampChallenge {
|
|
854
|
+
/** Ties the report to the issued challenge (echoed in {@link ScreenRampReport.nonce}). */
|
|
855
|
+
nonce: string;
|
|
856
|
+
colours: [ScreenRampColour, ScreenRampColour, ScreenRampColour];
|
|
857
|
+
/** Whole ms on the clip timeline, ascending, each inside the 800 to 2,000 ms window. */
|
|
858
|
+
onsetsMs: [number, number, number];
|
|
859
|
+
/** The palette the colours were drawn from (informational; the client renders `colours`). */
|
|
860
|
+
palette: ScreenRampColour[];
|
|
861
|
+
}
|
|
862
|
+
/** One rendered colour change: `tMs` on the clip timeline (whole ms, ≥ 0). */
|
|
863
|
+
interface ScreenRampRendered {
|
|
864
|
+
tMs: number;
|
|
865
|
+
colour: ScreenRampColour;
|
|
866
|
+
}
|
|
867
|
+
/** `LivenessCaptureInput.screenRamp`: what the SDK rendered against the issued {@link ScreenRampChallenge}. */
|
|
868
|
+
interface ScreenRampReport {
|
|
869
|
+
nonce: string;
|
|
870
|
+
/** In render order, at most three entries. */
|
|
871
|
+
rendered: ScreenRampRendered[];
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* `LivenessCaptureInput.provenance` (liveness v7 §4.5 item 2): how the web capture was made. Signals only, no media,
|
|
875
|
+
* no raw device identifiers. The backend allowlists it into the capture metadata; the model service turns it into
|
|
876
|
+
* the `virtual_camera | capture_tampered | replay_suspected` signals with its own thresholds and label list.
|
|
877
|
+
*/
|
|
878
|
+
interface CaptureProvenance {
|
|
879
|
+
/** The selected video track's `getSettings()`; `deviceIdHash` is the first 16 hex of SHA-256(deviceId). */
|
|
880
|
+
trackSettings: {
|
|
881
|
+
facingMode?: 'user' | 'environment' | 'left' | 'right';
|
|
882
|
+
frameRate?: number;
|
|
883
|
+
width?: number;
|
|
884
|
+
height?: number;
|
|
885
|
+
deviceIdHash?: string;
|
|
886
|
+
};
|
|
887
|
+
/** `MediaStreamTrack.getCapabilities` exists on this browser (absent on Firefox; virtual stacks often lack it). */
|
|
888
|
+
capabilitiesPresent: boolean;
|
|
889
|
+
/**
|
|
890
|
+
* The track label against the SDK's small list of virtual-camera products (`known_virtual`), the platform's own
|
|
891
|
+
* camera naming (`platform`), or anything else, an empty label included (`unknown`).
|
|
892
|
+
*/
|
|
893
|
+
labelClass: 'known_virtual' | 'unknown' | 'platform';
|
|
894
|
+
/**
|
|
895
|
+
* `requestVideoFrameCallback` statistics over the recording: frames seen, mean and standard deviation of the
|
|
896
|
+
* inter-frame gap (ms), and the mean `presentationTime - captureTime` (ms) when the browser reports `captureTime`
|
|
897
|
+
* (null otherwise). All zero with `n: 0` when the browser has no `requestVideoFrameCallback`.
|
|
898
|
+
*/
|
|
899
|
+
rvfc: {
|
|
900
|
+
n: number;
|
|
901
|
+
meanGapMs: number;
|
|
902
|
+
stdGapMs: number;
|
|
903
|
+
captureLatencyMs: number | null;
|
|
904
|
+
};
|
|
905
|
+
/** `getUserMedia` and `MediaStreamTrack.prototype.getSettings` are still native code (not replaced by a page script). */
|
|
906
|
+
prototypesIntact: boolean;
|
|
907
|
+
/**
|
|
908
|
+
* The engine ran this capture with a screen-ramp painter: a self capture handed the session's challenge with a
|
|
909
|
+
* `ramp` listener bound. `false` for a host that never binds `ramp`, an assisted capture, a keyframe-only capture
|
|
910
|
+
* or a session without a challenge. The backend keys `ramp_missing` on this flag, not on the SDK version: a
|
|
911
|
+
* `true` capture without `screenRamp` is missing, a `false` one is a client without the ramp.
|
|
912
|
+
*/
|
|
913
|
+
rampPainter: boolean;
|
|
914
|
+
}
|
|
874
915
|
/**
|
|
875
916
|
* {@link HostedCaptureTuning} with the native-only document fields typed. The wire shape is
|
|
876
917
|
* the same; `HostedSessionView.capture` stays the open {@link HostedCaptureTuning} so existing
|
|
@@ -947,7 +988,7 @@ interface HostedSessionView {
|
|
|
947
988
|
/**
|
|
948
989
|
* The FIRST allowlisted web-SDK origin of the owning org (Task 12), or null
|
|
949
990
|
* when none is registered. The hosted page posts the SDK popup postMessage
|
|
950
|
-
* events (event name
|
|
991
|
+
* events (event name, sessionId and the level when known) to exactly this origin — never `'*'`.
|
|
951
992
|
* The backend declares it required (`string | null`); optional here so
|
|
952
993
|
* pre-Task-12 consumers/fixtures stay valid (additive field, always on the
|
|
953
994
|
* wire from Task 12 onward).
|
|
@@ -1009,6 +1050,15 @@ interface HostedSessionView {
|
|
|
1009
1050
|
* (and on older APIs).
|
|
1010
1051
|
*/
|
|
1011
1052
|
retryAfter?: string;
|
|
1053
|
+
/**
|
|
1054
|
+
* What the session proved, once it is terminal (spec 2026-10-29 §3.2);
|
|
1055
|
+
* `null` while it runs. Absent on older APIs.
|
|
1056
|
+
*/
|
|
1057
|
+
level?: VerificationLevel | null;
|
|
1058
|
+
/** How the level was proved, once terminal; `null` while it runs. Absent on older APIs. */
|
|
1059
|
+
assurance?: VerificationAssurance | null;
|
|
1060
|
+
/** The subject (person) the session is linked to, once known. Absent on older APIs. */
|
|
1061
|
+
subjectId?: string;
|
|
1012
1062
|
/**
|
|
1013
1063
|
* A returning-user session (profile v2 step 5): the person verified before
|
|
1014
1064
|
* and this session only confirms it is still them — liveness and a face
|
|
@@ -1049,6 +1099,26 @@ interface HostedSessionView {
|
|
|
1049
1099
|
plan?: HostedPlanView;
|
|
1050
1100
|
/** Step 2b identity summary, present only while its confirmation is pending. */
|
|
1051
1101
|
identitySummary?: IdentitySummaryView;
|
|
1102
|
+
/**
|
|
1103
|
+
* Spec 2026-10-29 §6.7: the copy set the session's screens use: `human` (the person proves they are a real person:
|
|
1104
|
+
* one intro line, the short Human consent terms) or `identity`. Absent on older APIs: treat as `identity`.
|
|
1105
|
+
*/
|
|
1106
|
+
purpose?: "human" | "identity";
|
|
1107
|
+
/**
|
|
1108
|
+
* Spec 2026-10-29 §3.4: `true` when a flow fallback takes over a missing camera at the live step
|
|
1109
|
+
* (`POST /hosted/camera-unavailable` continues the session instead of ending it). Absent otherwise and on
|
|
1110
|
+
* older APIs. Offer "continue without a camera" only then, or on a `human` session.
|
|
1111
|
+
*/
|
|
1112
|
+
cameraUnavailableHandled?: true;
|
|
1113
|
+
/**
|
|
1114
|
+
* Spec 2026-10-29 D12: where the hosted completion screen sends the person (`returnUrl`, checked at session
|
|
1115
|
+
* create against the app's web origins or native scheme) and the partner's opaque `state`. Never the result.
|
|
1116
|
+
* Absent when the session has no return link (and on older APIs).
|
|
1117
|
+
*/
|
|
1118
|
+
link?: {
|
|
1119
|
+
returnUrl?: string;
|
|
1120
|
+
state?: string;
|
|
1121
|
+
};
|
|
1052
1122
|
}
|
|
1053
1123
|
/** `POST /hosted/consent` result — 201 on first record, 200 `{alreadyRecorded: true}` on replay. */
|
|
1054
1124
|
/**
|
|
@@ -1059,8 +1129,11 @@ type HostedConsentView = HostedSessionView & RecordConsentResult;
|
|
|
1059
1129
|
interface RecordConsentResult {
|
|
1060
1130
|
alreadyRecorded: boolean;
|
|
1061
1131
|
}
|
|
1062
|
-
/**
|
|
1063
|
-
|
|
1132
|
+
/**
|
|
1133
|
+
* Consent locale: the page's `[locale]` URL segment echoed back (HostedConsentSchema picklist). The six end-user
|
|
1134
|
+
* locales (spec 2026-10-29 §9); a backend older than Plan C accepts ar/fr/en only.
|
|
1135
|
+
*/
|
|
1136
|
+
type ConsentLocale = "ar" | "fr" | "en" | "es" | "pt" | "de";
|
|
1064
1137
|
/** Per-check projection in a {@link SessionView} — enum/id only, never civil data. */
|
|
1065
1138
|
interface SessionStepView {
|
|
1066
1139
|
checkType: CheckType;
|
|
@@ -1207,6 +1280,13 @@ interface LivenessCaptureInput {
|
|
|
1207
1280
|
mode?: 'self' | 'assisted';
|
|
1208
1281
|
/** The device kind. With `mode` set, the server applies the upright requirement (`capture_not_upright`) to `phone` only. */
|
|
1209
1282
|
formFactor?: 'phone' | 'tablet' | 'desktop';
|
|
1283
|
+
/**
|
|
1284
|
+
* Liveness v7 §4.5 item 1: the screen ramp the SDK rendered against the session's issued challenge. Absent when no
|
|
1285
|
+
* challenge was issued, in an assisted capture, in a keyframe-only capture, or when no host painted the ramp.
|
|
1286
|
+
*/
|
|
1287
|
+
screenRamp?: ScreenRampReport;
|
|
1288
|
+
/** Liveness v7 §4.5 item 2: how the capture was made. Sent whenever the engine had a camera track. */
|
|
1289
|
+
provenance?: CaptureProvenance;
|
|
1210
1290
|
}
|
|
1211
1291
|
/**
|
|
1212
1292
|
* population_registry adapter input. `nni` is the 10-digit NNI for an UNBOUND
|
|
@@ -1352,419 +1432,4 @@ interface SubmitCheckBody {
|
|
|
1352
1432
|
forceOutcome?: "pass" | "fail";
|
|
1353
1433
|
}
|
|
1354
1434
|
|
|
1355
|
-
|
|
1356
|
-
* Strip MIME parameters: `video/webm;codecs=vp8,opus` → `video/webm`.
|
|
1357
|
-
*
|
|
1358
|
-
* The capture engine (Task 4) emits `clipMimeType` WITH codec parameters, but
|
|
1359
|
-
* the presign allowlist holds BARE types only (['video/webm','video/mp4'] /
|
|
1360
|
-
* ['image/jpeg','image/png']) and the presigned PUT signs the exact declared
|
|
1361
|
-
* Content-Type. Exported so pages can normalize once and stay byte-consistent
|
|
1362
|
-
* between presign and PUT.
|
|
1363
|
-
*/
|
|
1364
|
-
declare function stripMimeParams(contentType: string): string;
|
|
1365
|
-
/** Media-bearing check types → the input field the promoted key goes into. */
|
|
1366
|
-
declare const MEDIA_INPUT_FIELD: {
|
|
1367
|
-
readonly liveness: "clipKey";
|
|
1368
|
-
readonly face_match: "imageKey";
|
|
1369
|
-
readonly doc_ocr: "imageKey";
|
|
1370
|
-
};
|
|
1371
|
-
/** Check types that take an uploaded media key (population_registry does not). */
|
|
1372
|
-
type MediaCheckType = keyof typeof MEDIA_INPUT_FIELD;
|
|
1373
|
-
interface SubmitOptions {
|
|
1374
|
-
/**
|
|
1375
|
-
* Sent as `x-idempotency-key` (the header IdempotencyInterceptor reads).
|
|
1376
|
-
* One key per LOGICAL submit — a flaky-network retry with the same key
|
|
1377
|
-
* replays the first response without burning another attempt.
|
|
1378
|
-
*/
|
|
1379
|
-
idempotencyKey?: string;
|
|
1380
|
-
/** SANDBOX-ONLY deterministic override (plan D-C); a live session 403s it. */
|
|
1381
|
-
forceOutcome?: "pass" | "fail";
|
|
1382
|
-
}
|
|
1383
|
-
interface UploadMedia {
|
|
1384
|
-
kind: MediaKind;
|
|
1385
|
-
blob: Blob;
|
|
1386
|
-
/** May carry codec params (engine `clipMimeType`) — stripped before presign AND PUT. */
|
|
1387
|
-
contentType: string;
|
|
1388
|
-
}
|
|
1389
|
-
interface HostedClientOptions {
|
|
1390
|
-
/** API origin, e.g. `https://api.sekyro.ai` — paths are `${apiOrigin}/api/v2/...`. */
|
|
1391
|
-
apiOrigin: string;
|
|
1392
|
-
/** The raw session token from the hosted URL (short code; legacy `cst_` during its TTL) — sent as `x-session-token` on every API call. */
|
|
1393
|
-
sessionToken: string;
|
|
1394
|
-
/** Injection seam (tests / non-window contexts). Defaults to `globalThis.fetch`. */
|
|
1395
|
-
fetch?: typeof globalThis.fetch;
|
|
1396
|
-
/** Per-request timeout for API calls (NOT the Spaces PUT). Default 30 000 ms. */
|
|
1397
|
-
requestTimeoutMs?: number;
|
|
1398
|
-
/**
|
|
1399
|
-
* Tuning for the ONLY automatic retry the client performs: 409
|
|
1400
|
-
* `idempotency_in_progress` (a concurrent identical request is mid-flight
|
|
1401
|
-
* server-side; the real response lands once it finishes). `attempts` counts
|
|
1402
|
-
* retries AFTER the first try. Defaults: 5 × 400 ms.
|
|
1403
|
-
*/
|
|
1404
|
-
inProgressRetry?: {
|
|
1405
|
-
attempts?: number;
|
|
1406
|
-
delayMs?: number;
|
|
1407
|
-
};
|
|
1408
|
-
}
|
|
1409
|
-
/**
|
|
1410
|
-
* Hand-authored typed client for the five session-token endpoints:
|
|
1411
|
-
*
|
|
1412
|
-
* GET /api/v2/hosted/session → {@link getSession}
|
|
1413
|
-
* POST /api/v2/hosted/consent → {@link recordConsent}
|
|
1414
|
-
* POST /api/v2/hosted/choice → {@link choose}
|
|
1415
|
-
* POST /api/v2/hosted/identity/confirm → {@link confirmIdentity}
|
|
1416
|
-
* GET /api/v2/hosted/identity/portrait → {@link identityPortrait}
|
|
1417
|
-
* POST /api/v2/sessions/:id/media → {@link presign}
|
|
1418
|
-
* POST /api/v2/sessions/:id/media/complete → {@link completeMedia}
|
|
1419
|
-
* POST /api/v2/sessions/:id/checks/:checkType → {@link submitCheck}
|
|
1420
|
-
*
|
|
1421
|
-
* plus the bare presigned Spaces PUT ({@link uploadToSpaces}) and the
|
|
1422
|
-
* presign→PUT→complete→submit composition ({@link uploadAndSubmit}).
|
|
1423
|
-
*
|
|
1424
|
-
* Envelopes (verified against sessions-docs.e2e-spec.ts):
|
|
1425
|
-
* - success: `{success: true, data}` — unwrapped here, methods return the payload;
|
|
1426
|
-
* - error: flat `{code, message}` → thrown as {@link HostedApiError}.
|
|
1427
|
-
*
|
|
1428
|
-
* The media/checks routes are `:id`-addressed while the token itself is the
|
|
1429
|
-
* only credential the page starts with — the client learns its sessionId from
|
|
1430
|
-
* `GET /hosted/session` (token-addressed) and lazily bootstraps it when a
|
|
1431
|
-
* `:id` route is called first.
|
|
1432
|
-
*
|
|
1433
|
-
* No automatic retry EXCEPT bounded short-delay retry on 409
|
|
1434
|
-
* `idempotency_in_progress`. Everything else — including 429 with its parsed
|
|
1435
|
-
* `retryAfterSeconds` — is surfaced to the page to handle.
|
|
1436
|
-
*/
|
|
1437
|
-
declare class HostedClient {
|
|
1438
|
-
private readonly apiOrigin;
|
|
1439
|
-
private readonly sessionToken;
|
|
1440
|
-
private readonly fetchImpl;
|
|
1441
|
-
private readonly requestTimeoutMs;
|
|
1442
|
-
private readonly retryAttempts;
|
|
1443
|
-
private readonly retryDelayMs;
|
|
1444
|
-
private sessionId;
|
|
1445
|
-
private bootstrap;
|
|
1446
|
-
/** D8: prefetched capture nonces (`armCapture`), each with its local expiry. */
|
|
1447
|
-
private captureNonces;
|
|
1448
|
-
private captureFetch;
|
|
1449
|
-
constructor(opts: HostedClientOptions);
|
|
1450
|
-
/** Token-addressed bootstrap — the hosted page's first call. Caches the sessionId. */
|
|
1451
|
-
getSession(): Promise<HostedSessionView>;
|
|
1452
|
-
/**
|
|
1453
|
-
* Record consent once (201; an idempotent replay answers 200 with
|
|
1454
|
-
* `alreadyRecorded: true`). Until recorded, media presign/complete AND check
|
|
1455
|
-
* submission answer 409 `consent_required`.
|
|
1456
|
-
*/
|
|
1457
|
-
recordConsent(locale: ConsentLocale): Promise<HostedConsentView>;
|
|
1458
|
-
/**
|
|
1459
|
-
* Pick an option of the current choice (Sekyro flows §7.4): `plan.choice`'s
|
|
1460
|
-
* `nodeId` and one of its option ids. Returns the updated hosted view —
|
|
1461
|
-
* render it. The person may switch while `plan.choice.locked` is false.
|
|
1462
|
-
* Errors: 409 `choice_locked`, 409 `choice_option_unavailable`, 404 `choice_not_found`.
|
|
1463
|
-
*/
|
|
1464
|
-
choose(nodeId: string, option: string): Promise<HostedSessionView>;
|
|
1465
|
-
/**
|
|
1466
|
-
* Answer the identity summary (`identitySummary` in the view, Step 2b):
|
|
1467
|
-
* `confirm` lifts the live-photo gate, `retake` re-opens the identity checks
|
|
1468
|
-
* that produced the data. Returns the updated hosted view; 409
|
|
1469
|
-
* `identity_confirm_locked` when nothing is pending or no retake is left.
|
|
1470
|
-
*/
|
|
1471
|
-
confirmIdentity(decision: IdentityConfirmDecision): Promise<HostedSessionView>;
|
|
1472
|
-
/**
|
|
1473
|
-
* The summary portrait (`identitySummary.portrait.available`) as a JPEG
|
|
1474
|
-
* `Blob`, fetched with the session-token header (`Cache-Control: no-store`).
|
|
1475
|
-
* Show it from memory (`URL.createObjectURL`, revoked when done) — never
|
|
1476
|
-
* cache or store it.
|
|
1477
|
-
*/
|
|
1478
|
-
identityPortrait(): Promise<Blob>;
|
|
1479
|
-
/**
|
|
1480
|
-
* Presign a Spaces PUT for a new pending object. `contentType` is stripped of
|
|
1481
|
-
* MIME parameters defensively (the allowlist holds bare types; the engine's
|
|
1482
|
-
* `clipMimeType` carries codec params) — PUT with the SAME bare type, or the
|
|
1483
|
-
* signed-header check rejects the upload.
|
|
1484
|
-
*/
|
|
1485
|
-
presign(kind: MediaKind, contentType: string, contentLength: number): Promise<PresignUploadResult>;
|
|
1486
|
-
/**
|
|
1487
|
-
* D8: prefetch live-camera capture nonces when a camera capture STARTS, so the
|
|
1488
|
-
* presigns that follow (`presignCapture`) need no extra round trip. Never
|
|
1489
|
-
* throws; an older backend without the route simply leaves the pool empty.
|
|
1490
|
-
*/
|
|
1491
|
-
armCapture(count?: number): void;
|
|
1492
|
-
/**
|
|
1493
|
-
* D8: presign a LIVE-CAMERA image / clip — like {@link presign}, plus the
|
|
1494
|
-
* capture proof: a fresh single-use nonce (pooled by {@link armCapture}, else
|
|
1495
|
-
* fetched now), the engine and the capture duration. When no nonce can be had
|
|
1496
|
-
* (route absent, network) the presign goes out without a proof — the backend
|
|
1497
|
-
* decides (`signal` flags it, `enforce` refuses it). Only the SDK's own capture
|
|
1498
|
-
* flows call this; a picked file goes through {@link presign}.
|
|
1499
|
-
*/
|
|
1500
|
-
presignCapture(kind: MediaKind, contentType: string, contentLength: number, context?: CaptureContext): Promise<PresignUploadResult>;
|
|
1501
|
-
/** D8: one pooled (still fresh) nonce, else one fetched now; undefined when none can be had. */
|
|
1502
|
-
private takeCaptureNonce;
|
|
1503
|
-
/** D8: fetch `count` nonces into the pool (one request in flight at a time). Never throws. */
|
|
1504
|
-
private fillCaptureNonces;
|
|
1505
|
-
/**
|
|
1506
|
-
* Bare PUT to the presigned Spaces URL: EXACTLY the signed headers — the
|
|
1507
|
-
* declared Content-Type and the blob body. NO `x-session-token` (the
|
|
1508
|
-
* signature IS the credential; an extra header breaks nothing but leaks the
|
|
1509
|
-
* token to a third-party host) and no JSON envelope.
|
|
1510
|
-
*
|
|
1511
|
-
* `contentType` is param-stripped here too (idempotent for bare types): the
|
|
1512
|
-
* presign strips internally, so a caller composing manually with the engine's
|
|
1513
|
-
* parameterful `clipMimeType` would otherwise sign `video/webm` but PUT
|
|
1514
|
-
* `video/webm;codecs=…` — a signed-header mismatch S3 rejects at runtime.
|
|
1515
|
-
*
|
|
1516
|
-
* Timeout: 15 min (`AbortSignal.timeout(900_000)`, matching the presign TTL)
|
|
1517
|
-
* rather than the API calls' 30 s — a 15 MB clip on a slow link legitimately
|
|
1518
|
-
* exceeds 30 s, but a stalled in-flight socket must still be bounded (the TTL
|
|
1519
|
-
* alone only bounds when a PUT can START).
|
|
1520
|
-
*
|
|
1521
|
-
* Failures are ALWAYS typed: non-2xx throws {@link HostedApiError} with the
|
|
1522
|
-
* client-synthesized `upload_failed` (message carries a truncated S3 body
|
|
1523
|
-
* snippet — e.g. SignatureDoesNotMatch); a mid-transfer drop → `network_error`;
|
|
1524
|
-
* the timeout → `timeout`.
|
|
1525
|
-
*/
|
|
1526
|
-
uploadToSpaces(uploadUrl: string, blob: Blob, contentType: string): Promise<void>;
|
|
1527
|
-
/** Finalize an upload: the backend sniffs + promotes; returns the PROMOTED key to submit. */
|
|
1528
|
-
completeMedia(key: string): Promise<CompleteMediaResult>;
|
|
1529
|
-
/**
|
|
1530
|
-
* Submit one check. Sends `{input, forceOutcome?}` (SubmitCheckSchema) and the
|
|
1531
|
-
* optional `x-idempotency-key` header. Returns the hosted view after the
|
|
1532
|
-
* submission (Sekyro flows §8.2: with its `plan`) — render it.
|
|
1533
|
-
*/
|
|
1534
|
-
submitCheck<T extends CheckType>(checkType: T, input: CheckInputByType[T], opts?: SubmitOptions): Promise<HostedSessionView>;
|
|
1535
|
-
/**
|
|
1536
|
-
* Convenience composition: presign → PUT → complete → submit, passing the
|
|
1537
|
-
* PROMOTED key (from complete's response — never the pending presign key)
|
|
1538
|
-
* into the check's media input field (`clipKey` for liveness, `imageKey` for
|
|
1539
|
-
* face_match/doc_ocr). `extraInput` carries the remaining input fields
|
|
1540
|
-
* (liveness `attestation`, doc_ocr `side`). The media content type is
|
|
1541
|
-
* param-stripped ONCE and used for both presign and PUT, so the signed
|
|
1542
|
-
* header always matches.
|
|
1543
|
-
*/
|
|
1544
|
-
uploadAndSubmit<T extends MediaCheckType>(checkType: T, media: UploadMedia, extraInput: Omit<CheckInputByType[T], (typeof MEDIA_INPUT_FIELD)[T]>, opts?: SubmitOptions): Promise<HostedSessionView>;
|
|
1545
|
-
/** The token's own sessionId — cached from getSession(), lazily bootstrapped. */
|
|
1546
|
-
private ensureSessionId;
|
|
1547
|
-
/**
|
|
1548
|
-
* One API request: `${apiOrigin}/api/v2${path}`, `x-session-token` always,
|
|
1549
|
-
* AbortSignal timeout (30 s default), `{success, data}` unwrap on 2xx, flat
|
|
1550
|
-
* `{code, message}` → {@link HostedApiError} on non-2xx. EVERY failure is
|
|
1551
|
-
* typed: a rejected fetch → `network_error`, the timeout → `timeout`, an
|
|
1552
|
-
* unparseable 2xx body → `unknown_error` — the page never sees a raw
|
|
1553
|
-
* TypeError/DOMException. The ONLY automatic retry is 409
|
|
1554
|
-
* `idempotency_in_progress` (bounded, short delay).
|
|
1555
|
-
*/
|
|
1556
|
-
private api;
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
/** Luma at or above this counts as clipped / specular. */
|
|
1560
|
-
declare const CLIPPED_LUMA = 250;
|
|
1561
|
-
/** Laplacian-variance reference (same as the liveness gate's frame-quality SHARP_REF). */
|
|
1562
|
-
declare const ICAO_SHARP_REF = 180;
|
|
1563
|
-
interface LumaPlane {
|
|
1564
|
-
data: Uint8Array;
|
|
1565
|
-
width: number;
|
|
1566
|
-
height: number;
|
|
1567
|
-
}
|
|
1568
|
-
/** Rec.601 luma of RGBA pixels. */
|
|
1569
|
-
declare function lumaPlane(image: {
|
|
1570
|
-
data: Uint8ClampedArray | Uint8Array;
|
|
1571
|
-
width: number;
|
|
1572
|
-
height: number;
|
|
1573
|
-
}): LumaPlane;
|
|
1574
|
-
interface RegionStats {
|
|
1575
|
-
mean: number;
|
|
1576
|
-
sd: number;
|
|
1577
|
-
/** Fraction of pixels at or above {@link CLIPPED_LUMA}. */
|
|
1578
|
-
clipped: number;
|
|
1579
|
-
count: number;
|
|
1580
|
-
}
|
|
1581
|
-
/** Mean / SD / clipped fraction of a box, optionally excluding a second box. */
|
|
1582
|
-
declare function regionStats(plane: LumaPlane, box: Box, exclude?: Box): RegionStats;
|
|
1583
|
-
interface FaceLighting {
|
|
1584
|
-
faceLuma: number;
|
|
1585
|
-
/** Left-half / right-half mean luma (image halves, split at the nose). */
|
|
1586
|
-
halfRatio: number;
|
|
1587
|
-
clipped: number;
|
|
1588
|
-
}
|
|
1589
|
-
declare function faceLighting(plane: LumaPlane, g: FaceGeometry): FaceLighting | null;
|
|
1590
|
-
/** Specular fraction inside both eye regions (spec §5.4 glasses glare). */
|
|
1591
|
-
declare function eyeSpecular(plane: LumaPlane, g: FaceGeometry): number | null;
|
|
1592
|
-
interface BackgroundStats {
|
|
1593
|
-
luma: number;
|
|
1594
|
-
sd: number;
|
|
1595
|
-
/** Pixels measured — too few means the corners left the frame. */
|
|
1596
|
-
count: number;
|
|
1597
|
-
}
|
|
1598
|
-
/**
|
|
1599
|
-
* Background heuristic: the two top corners of the ICAO window (each 20 % wide,
|
|
1600
|
-
* 25 % tall from 4 % down), minus the head (the face box widened by 40 % and
|
|
1601
|
-
* extended to the top of the window for hair). `null` when nothing is left.
|
|
1602
|
-
*/
|
|
1603
|
-
declare function backgroundStats(plane: LumaPlane, g: FaceGeometry): BackgroundStats | null;
|
|
1604
|
-
/** Laplacian variance over the face core on a ≤96×96 grid, normalised 0..1 by {@link ICAO_SHARP_REF}. */
|
|
1605
|
-
declare function faceSharpness(plane: LumaPlane, g: FaceGeometry): number | null;
|
|
1606
|
-
/** Every pixel measure of one frame (`null` fields: not measurable). */
|
|
1607
|
-
interface IcaoPixelStats {
|
|
1608
|
-
lighting: FaceLighting | null;
|
|
1609
|
-
eyeSpecular: number | null;
|
|
1610
|
-
background: BackgroundStats | null;
|
|
1611
|
-
sharpness: number | null;
|
|
1612
|
-
}
|
|
1613
|
-
declare function icaoPixelStats(plane: LumaPlane, g: FaceGeometry): IcaoPixelStats;
|
|
1614
|
-
|
|
1615
|
-
/** The client gate's criteria, in coaching priority order. */
|
|
1616
|
-
declare const ICAO_GATE_CRITERIA: readonly ["face", "framing", "pose", "eyes", "mouth", "glare", "lighting", "background", "resolution", "sharpness"];
|
|
1617
|
-
type IcaoGateCriterion = (typeof ICAO_GATE_CRITERIA)[number];
|
|
1618
|
-
/** Coaching keys (copy `portrait.coach.<key>`). */
|
|
1619
|
-
type IcaoCoachKey = "no_face" | "multiple_faces" | "center" | "too_close" | "pose" | "eyes" | "mouth" | "glare" | "lighting" | "lighting_side" | "background" | "resolution" | "hold_still" | "hold";
|
|
1620
|
-
/** One frame as the gate sees it. Geometry in SOURCE (stream) pixels. */
|
|
1621
|
-
interface IcaoFrameObservation {
|
|
1622
|
-
frameWidth: number;
|
|
1623
|
-
frameHeight: number;
|
|
1624
|
-
/** Faces the landmarker found (the gate wants exactly one). */
|
|
1625
|
-
faces: number;
|
|
1626
|
-
geometry: FaceGeometry | null;
|
|
1627
|
-
/** Facial transformation matrix (4×4, column-major), when produced. */
|
|
1628
|
-
matrix?: readonly number[] | null;
|
|
1629
|
-
/** Blendshape scores by category name (`eyeBlinkLeft`, `jawOpen`, …). */
|
|
1630
|
-
blendshapes?: Readonly<Record<string, number>> | null;
|
|
1631
|
-
/** Pixel heuristics on the analysis frame; `null` when not measured. */
|
|
1632
|
-
stats?: IcaoPixelStats | null;
|
|
1633
|
-
/**
|
|
1634
|
-
* The background-uniformity check (segmenter, or the strip fallback), the
|
|
1635
|
-
* latest measurement — it runs a few times per second, not on every frame.
|
|
1636
|
-
* When present it decides the `background` criterion; `null` = not measurable.
|
|
1637
|
-
*/
|
|
1638
|
-
backgroundCheck?: BackgroundUniformity | null;
|
|
1639
|
-
}
|
|
1640
|
-
interface IcaoCriterionState {
|
|
1641
|
-
criterion: IcaoGateCriterion;
|
|
1642
|
-
pass: boolean;
|
|
1643
|
-
/** Passed continuously for `holdMs`. */
|
|
1644
|
-
held: boolean;
|
|
1645
|
-
/** A failing soft criterion the gate stopped waiting for. */
|
|
1646
|
-
waived: boolean;
|
|
1647
|
-
/** The measured value (degrees, ratio, luma, px…) — coaching / telemetry only. */
|
|
1648
|
-
value: number | null;
|
|
1649
|
-
/** Coaching key when failing. */
|
|
1650
|
-
coach: IcaoCoachKey | null;
|
|
1651
|
-
}
|
|
1652
|
-
interface IcaoGateUpdate {
|
|
1653
|
-
criteria: IcaoCriterionState[];
|
|
1654
|
-
/** The one message to show (`hold` when everything passes and the gate is counting down). */
|
|
1655
|
-
coach: IcaoCoachKey;
|
|
1656
|
-
/** The lowest failing criterion (`null` when all pass or are waived). */
|
|
1657
|
-
failing: IcaoGateCriterion | null;
|
|
1658
|
-
/** 0..1 — held criteria, for a progress ring. */
|
|
1659
|
-
progress: number;
|
|
1660
|
-
/** Take the portrait frame now. */
|
|
1661
|
-
ready: boolean;
|
|
1662
|
-
/**
|
|
1663
|
-
* The user's own eye-openness baseline, once known. Unit (D9d, everywhere): openness =
|
|
1664
|
-
* 1 − the Landmarker's `eyeBlink{Left,Right}` blendshape; per frame the mean of the
|
|
1665
|
-
* two eyes; the baseline is the `baseline.percentile` (0.8) quantile over the recent
|
|
1666
|
-
* frontal, single-face frames. kyc-portrait compares the lower eye against it.
|
|
1667
|
-
*/
|
|
1668
|
-
baseline: number | null;
|
|
1669
|
-
pose: HeadPose | null;
|
|
1670
|
-
}
|
|
1671
|
-
/** The on-device result submitted with the portrait (`gate`, §4.9): numbers only. */
|
|
1672
|
-
interface IcaoGateSummary {
|
|
1673
|
-
/** In (0, 1]: the gate's eye baseline (1 − blink blendshape; see {@link IcaoGateUpdate.baseline}). */
|
|
1674
|
-
baselineEyeOpenness?: number;
|
|
1675
|
-
criteria: Partial<Record<IcaoGateCriterion, {
|
|
1676
|
-
pass: boolean;
|
|
1677
|
-
value: number | null;
|
|
1678
|
-
waived?: boolean;
|
|
1679
|
-
}>>;
|
|
1680
|
-
/**
|
|
1681
|
-
* The device verdict with the server's criterion names — the submission's
|
|
1682
|
-
* `gate.criteria`: `framing` folds into `resolution`, unmeasured criteria are
|
|
1683
|
-
* omitted (occlusion always; background when the profile does not require it).
|
|
1684
|
-
*/
|
|
1685
|
-
verdict?: Partial<Record<IcaoCriterion, boolean>>;
|
|
1686
|
-
/** The background-uniformity measurement behind the `background` criterion (numbers only). */
|
|
1687
|
-
backgroundCheck?: Omit<BackgroundUniformity, "pixels">;
|
|
1688
|
-
}
|
|
1689
|
-
interface Measured {
|
|
1690
|
-
pass: boolean;
|
|
1691
|
-
value: number | null;
|
|
1692
|
-
coach: IcaoCoachKey | null;
|
|
1693
|
-
/** Not measured on this frame (left out of the verdict). */
|
|
1694
|
-
none?: true;
|
|
1695
|
-
}
|
|
1696
|
-
/** The criteria a profile sets limits for (conformance.json `criteria`). */
|
|
1697
|
-
type IcaoJudgedCriterion = "pose" | "eyes" | "mouth" | "lighting" | "background" | "resolution";
|
|
1698
|
-
/**
|
|
1699
|
-
* One frame's measures in the server's units (conformance.json `measures`);
|
|
1700
|
-
* `null` = not measured on this frame.
|
|
1701
|
-
*/
|
|
1702
|
-
interface IcaoMeasures {
|
|
1703
|
-
/** Degrees; `pitch` is RAW (before `pitchOffsetDeg`). `null` = no transformation matrix. */
|
|
1704
|
-
pose: HeadPose | null;
|
|
1705
|
-
/** The value shown for a pose without matrix (roll from the eye line). */
|
|
1706
|
-
eyeLineRoll?: number;
|
|
1707
|
-
/** Openness of each eye (1 − the `eyeBlink*` blendshape). */
|
|
1708
|
-
eyes: {
|
|
1709
|
-
left: number;
|
|
1710
|
-
right: number;
|
|
1711
|
-
} | null;
|
|
1712
|
-
/** The person's eye-openness baseline; `null` = the absolute floor only. */
|
|
1713
|
-
baseline: number | null;
|
|
1714
|
-
/** Blendshapes: `jawOpen`, the larger `mouthSmile*`, `mouthPucker`. */
|
|
1715
|
-
mouth: {
|
|
1716
|
-
jawOpen: number;
|
|
1717
|
-
smile: number;
|
|
1718
|
-
pucker: number;
|
|
1719
|
-
} | null;
|
|
1720
|
-
lighting: {
|
|
1721
|
-
faceLuma: number;
|
|
1722
|
-
halfRatio: number;
|
|
1723
|
-
clipped: number;
|
|
1724
|
-
} | null;
|
|
1725
|
-
background: {
|
|
1726
|
-
luma: number;
|
|
1727
|
-
sd: number;
|
|
1728
|
-
} | null;
|
|
1729
|
-
/** The web background-uniformity check; when present (and enabled) it decides the background. */
|
|
1730
|
-
uniformity?: Pick<BackgroundUniformity, "uniform" | "colorStd"> | null;
|
|
1731
|
-
iod: number;
|
|
1732
|
-
frameWidth: number;
|
|
1733
|
-
frameHeight: number;
|
|
1734
|
-
}
|
|
1735
|
-
/**
|
|
1736
|
-
* The per-criterion decision on one frame's measures — pure, the same rule as
|
|
1737
|
-
* kyc-portrait and the native gates (packages/sekyro-contract/icao/conformance.json;
|
|
1738
|
-
* limits are inclusive).
|
|
1739
|
-
*/
|
|
1740
|
-
declare function judgeIcao(m: IcaoMeasures, t: ResolvedIcaoTuning): Record<IcaoJudgedCriterion, Measured>;
|
|
1741
|
-
/** Openness of one eye from the Landmarker's blink blendshape (1 − blink). */
|
|
1742
|
-
declare function eyeOpenness(blendshapes: Readonly<Record<string, number>> | null | undefined): {
|
|
1743
|
-
left: number;
|
|
1744
|
-
right: number;
|
|
1745
|
-
blinkLeft: number;
|
|
1746
|
-
blinkRight: number;
|
|
1747
|
-
} | null;
|
|
1748
|
-
/** The `p`-quantile (0..1) of a sample, nearest-rank. */
|
|
1749
|
-
declare function percentile(values: readonly number[], p: number): number | null;
|
|
1750
|
-
/** Score one frame against the limits. Pure; `baseline` is the eye baseline so far. */
|
|
1751
|
-
declare function scoreFrame(frame: IcaoFrameObservation, t: ResolvedIcaoTuning, baseline: number | null): {
|
|
1752
|
-
results: Record<IcaoGateCriterion, Measured>;
|
|
1753
|
-
pose: HeadPose | null;
|
|
1754
|
-
};
|
|
1755
|
-
interface IcaoGate {
|
|
1756
|
-
push(frame: IcaoFrameObservation, nowMs: number): IcaoGateUpdate;
|
|
1757
|
-
/** The last update (`null` before the first frame). */
|
|
1758
|
-
last(): IcaoGateUpdate | null;
|
|
1759
|
-
/** The submission's `gate` block from the last update. */
|
|
1760
|
-
summary(): IcaoGateSummary;
|
|
1761
|
-
/** Start the holds over (a retake). The eye baseline is kept: it describes the person. */
|
|
1762
|
-
reset(): void;
|
|
1763
|
-
}
|
|
1764
|
-
interface IcaoGateOptions {
|
|
1765
|
-
/** `alert`: coaching only — ready `alertGraceMs` after the face was accepted at the latest. Default `reject`. */
|
|
1766
|
-
policy?: "reject" | "alert";
|
|
1767
|
-
}
|
|
1768
|
-
declare function createIcaoGate(t: ResolvedIcaoTuning, options?: IcaoGateOptions): IcaoGate;
|
|
1769
|
-
|
|
1770
|
-
export { type NfcStepView as $, type AcceptedDocumentType as A, type HostedSessionView as B, type CaptureMode as C, type DecisionReason as D, type EidAfterPass as E, type FaceMatchReason as F, type HostedStepView as G, type HeadPose as H, type HostedVoiceLocale as I, type HostedVoiceView as J, type IcaoCaptureTuning as K, type IcaoCoachKey as L, type IcaoCriterion as M, type IcaoCriterionState as N, type IcaoGateCriterion as O, type IcaoGateSummary as P, type IcaoGateUpdate as Q, type IcaoReportEntry as R, type IdentityConfirmDecision as S, type IdentityMethod as T, type IdentitySummarySource as U, type IdentitySummaryView as V, type LivenessReason as W, type MatchReason as X, type MethodChoiceView as Y, type NationalEidOption as Z, type NfcChipReason as _, type CheckReason as a, type ConsentLocale as a$, type OtpChoiceView as a0, type PhoneOtpReason as a1, type PlanAttempts as a2, type PlanChoiceKind as a3, type PlanChoiceOption as a4, type PlanChoiceView as a5, type PlanSectionView as a6, type PlanStepView as a7, type PolicyFailureReason as a8, type PopulationReason as a9, backgroundStats as aA, createIcaoGate as aB, eyeLineRoll as aC, eyeOpenness as aD, eyeSpecular as aE, faceGeometry as aF, faceLighting as aG, faceSharpness as aH, icaoPixelStats as aI, icaoWindow as aJ, judgeIcao as aK, lumaPlane as aL, percentile as aM, portraitCropRegion as aN, poseFromMatrix as aO, regionStats as aP, resolveIcaoTuning as aQ, scoreFrame as aR, windowOverflow as aS, type PersonMask as aT, HostedClient as aU, type AttestationInput as aV, type CaptureContext as aW, type CaptureNoncesResult as aX, type CaptureProof as aY, type CheckInputByType as aZ, type CompleteMediaResult as a_, type PortraitIcaoInput as aa, type PortraitIcaoReason as ab, type SessionFailureReason as ac, type SessionOutcome as ad, type SessionStatus as ae, type StepSection as af, type BackgroundStats as ag, type Box as ah, CLIPPED_LUMA as ai, type FaceGeometry as aj, type FaceLighting as ak, ICAO_CANVAS as al, ICAO_FALLBACK as am, ICAO_GATE_CRITERIA as an, ICAO_SHARP_REF as ao, type IcaoFrameObservation as ap, type IcaoGate as aq, type IcaoGateOptions as ar, type IcaoJudgedCriterion as as, type IcaoMeasures as at, type IcaoPixelStats as au, type IcaoProfile as av, type LumaPlane as aw, type Point as ax, type RegionStats as ay, type ResolvedIcaoTuning as az, type CheckState as b, type DocDeviceRead as b0, type DocOcrInput as b1, type DocSide as b2, type EmailOtpInput as b3, type FaceMatchInput as b4, type HostedClientOptions as b5, type LivenessCaptureInput as b6, type LivenessInput as b7, type MediaCheckType as b8, type MediaKind as b9, type PhoneOtpInput as ba, type PopulationInput as bb, type PresignRequest as bc, type PresignUploadResult as bd, type RecordConsentResult as be, type SessionStepView as bf, type SessionView as bg, type SubmitCheckBody as bh, type SubmitOptions as bi, type UploadMedia as bj, stripMimeParams as bk, type CheckType as c, type ContactChannel as d, type DocReason as e, type EidAuthInput as f, type EidReason as g, type EmailOtpReason as h, type HostedAcceptedDocuments as i, type HostedBranding as j, type HostedBrandingColorKey as k, type HostedCaptureTuning as l, type HostedConsentView as m, type HostedDocumentCaptureTuning as n, type HostedDocumentScanTuning as o, type HostedEidView as p, type HostedEmailOtpView as q, type HostedFlowRef as r, type HostedIcaoPolicy as s, type HostedIntegrity as t, type HostedLivePhotoTuning as u, type HostedNativeCaptureTuning as v, type HostedOcrTuning as w, type HostedOtpView as x, type HostedPlanView as y, type HostedPortraitView as z };
|
|
1435
|
+
export { type IdentitySummaryView as $, type AcceptedDocumentType as A, type BackgroundUniformity as B, type ConsentLocale as C, type DecisionReason as D, type EidAfterPass as E, type FaceMatchReason as F, type HostedIntegrity as G, type HostedSessionView as H, type IdentityConfirmDecision as I, type HostedLivePhotoTuning as J, type HostedLivenessCaptureTuning as K, type HostedNativeCaptureTuning as L, type MediaKind as M, type HostedOcrTuning as N, type HostedOtpView as O, type PresignUploadResult as P, type HostedPlanView as Q, type ResolvedIcaoTuning as R, type ScreenRampColour as S, type HostedPortraitView as T, type HostedStepView as U, type HostedVoiceLocale as V, type HostedVoiceView as W, type IcaoCaptureTuning as X, type IcaoReportEntry as Y, type IdentityMethod as Z, type IdentitySummarySource as _, type HostedConsentView as a, type LivenessReason as a0, type MatchReason as a1, type MethodChoiceView as a2, type NationalEidOption as a3, type NfcChipReason as a4, type NfcStepView as a5, type OtpChoiceView as a6, type PhoneOtpReason as a7, type PlanAttempts as a8, type PlanChoiceKind as a9, type DocOcrInput as aA, type DocSide as aB, type EmailOtpInput as aC, type FaceMatchInput as aD, type LivenessCaptureInput as aE, type LivenessInput as aF, type PhoneOtpInput as aG, type PopulationInput as aH, type PresignRequest as aI, type RecordConsentResult as aJ, type SessionStepView as aK, type SessionView as aL, type SubmitCheckBody as aM, type PlanChoiceOption as aa, type PlanChoiceView as ab, type PlanSectionView as ac, type PlanStepView as ad, type PolicyFailureReason as ae, type PopulationReason as af, type PortraitIcaoInput as ag, type PortraitIcaoReason as ah, type RetakeHint as ai, type ScreenRampChallenge as aj, type ScreenRampRendered as ak, type ScreenRampReport as al, type SessionFailureReason as am, type SessionOutcome as an, type SessionStatus as ao, type StepSection as ap, type VerificationAssurance as aq, type VerificationLevel as ar, ICAO_FALLBACK as as, type IcaoProfile as at, resolveIcaoTuning as au, type PersonMask as av, type AttestationInput as aw, type CaptureNoncesResult as ax, type CaptureProof as ay, type DocDeviceRead as az, type CameraUnavailableCause as b, type CaptureContext as c, type CompleteMediaResult as d, type CheckType as e, type CheckInputByType as f, type IcaoCriterion as g, type CaptureMode as h, type CaptureProvenance as i, type CheckReason as j, type CheckState as k, type ContactChannel as l, type DocReason as m, type EidAuthInput as n, type EidReason as o, type EmailOtpReason as p, type HostedAcceptedDocuments as q, type HostedBranding as r, type HostedBrandingColorKey as s, type HostedCaptureTuning as t, type HostedDocumentCaptureTuning as u, type HostedDocumentScanTuning as v, type HostedEidView as w, type HostedEmailOtpView as x, type HostedFlowRef as y, type HostedIcaoPolicy as z };
|