@sekyro/web 0.1.0-rc.10 → 0.1.0-rc.12
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 +18 -0
- package/dist/{capture-session-doc-GK6G7JOI.js → capture-session-doc-KW5VR4IR.js} +1 -1
- package/dist/{capture-session-v3-DGG2stO6.d.ts → capture-session-v3-DqUUcIU-.d.ts} +34 -3
- package/dist/{capture-session-v3-CmJw_bK0.d.cts → capture-session-v3-xNtY5m-7.d.cts} +34 -3
- package/dist/{chunk-BAGSM67V.js → chunk-4IVRXJR2.js} +1 -1
- package/dist/chunk-6DPFJNGL.js +1 -0
- package/dist/{chunk-SEC64KZ3.js → chunk-73M7LS4H.js} +1 -1
- package/dist/chunk-EF52BRBD.js +1 -0
- package/dist/chunk-GT2ZLGF7.js +1 -0
- package/dist/chunk-IF6YOFFO.js +1 -0
- package/dist/chunk-MUVEJRGK.js +1 -0
- package/dist/{chunk-UGMHAFEY.js → chunk-OBLQOE66.js} +1 -1
- package/dist/chunk-U6TYL2IJ.js +1 -0
- package/dist/{chunk-FFDB6LQN.js → chunk-U6YQAQBD.js} +1 -1
- package/dist/chunk-Y7S7LYCL.js +1 -0
- package/dist/chunk-YZH5PR5R.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-PXOJHLWV.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-CDOTGHQj.d.ts} +87 -9
- package/dist/{create-verification-CtqF4A9W.d.cts → create-verification-D4749F6L.d.cts} +87 -9
- package/dist/icao-gate-BRuIgOE2.d.cts +503 -0
- package/dist/icao-gate-CphntEQ2.d.ts +503 -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-2FJLUALJ.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-4rgeNIlz.d.cts} +179 -498
- package/dist/{icao-gate-terzKYD7.d.ts → types-4rgeNIlz.d.ts} +179 -498
- 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" | "payment_method_required" | "spend_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
|
|
@@ -380,6 +313,13 @@ type NfcChipReason = "chip_read_failed" | "chip_access_denied" | "chip_parse_fai
|
|
|
380
313
|
* switch to the camera path when the session offers it.
|
|
381
314
|
*/
|
|
382
315
|
type EidReason = "eid_identifier_invalid" | "eid_code_invalid" | "eid_code_expired" | "eid_locked" | "eid_not_enrolled" | "eid_unavailable" | "eid_resend_too_soon" | "eid_resend_limit";
|
|
316
|
+
/**
|
|
317
|
+
* Reasons of the age check (selfie) step (`age_estimation`, run by the server after the liveness step):
|
|
318
|
+
* `age_uncertain` (the estimate did not settle the minimum age) and `age_unavailable` (the estimate could not run)
|
|
319
|
+
* step up to the document path when the flow has one; `underage_estimated` (clearly under the flow's minimum age)
|
|
320
|
+
* is final and ends the session.
|
|
321
|
+
*/
|
|
322
|
+
type AgeEstimationReason = "age_uncertain" | "age_unavailable" | "underage_estimated";
|
|
383
323
|
/**
|
|
384
324
|
* Any frozen reason code. The backend declares the field `string`, but the
|
|
385
325
|
* taxonomy is frozen (do-not-drift) — the union IS the contract. NB: liveness
|
|
@@ -415,7 +355,12 @@ type SessionFailureReason = "location_not_allowed" | "anonymizer_blocked" | "cap
|
|
|
415
355
|
* `nationality_not_allowed`, `underage`, `age_unverifiable`,
|
|
416
356
|
* `document_nni_mismatch`).
|
|
417
357
|
*/
|
|
418
|
-
type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "document_nni_mismatch";
|
|
358
|
+
type PolicyFailureReason = SessionFailureReason | "document_type_not_accepted" | "nationality_not_allowed" | "underage" | "age_unverifiable" | "document_nni_mismatch" | "camera_unavailable" | "underage_estimated";
|
|
359
|
+
/**
|
|
360
|
+
* Why the person has no camera (spec 2026-10-29 §3.4, 2026-10-30): `denied` when the camera permission was refused,
|
|
361
|
+
* `no_camera` when there is no usable camera (none found, an insecure page or a browser that cannot capture).
|
|
362
|
+
*/
|
|
363
|
+
type CameraUnavailableCause = "denied" | "no_camera";
|
|
419
364
|
/**
|
|
420
365
|
* How the person proves their identity when the app makes the document
|
|
421
366
|
* optional for registry nationals (profile v2 step 3): type their national
|
|
@@ -510,6 +455,11 @@ interface PlanStepView extends Omit<HostedStepView, "checkType" | "attemptsRemai
|
|
|
510
455
|
checkType: CheckType | (string & {});
|
|
511
456
|
section: StepSection;
|
|
512
457
|
attempts: PlanAttempts;
|
|
458
|
+
/**
|
|
459
|
+
* Who acts on the step: `person` (a screen) or `server` (the backend runs it while the person waits). Sent by
|
|
460
|
+
* newer servers; a client renders an unknown `server` step as processing instead of asking for an update.
|
|
461
|
+
*/
|
|
462
|
+
interaction?: "person" | "server";
|
|
513
463
|
}
|
|
514
464
|
/** A segment of the progress bar (`plan.sections`): the sections still possible on any remaining path. */
|
|
515
465
|
interface PlanSectionView {
|
|
@@ -708,6 +658,13 @@ interface NfcStepView {
|
|
|
708
658
|
source: "capture" | "document" | (string & {});
|
|
709
659
|
};
|
|
710
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Liveness v7 §5.2: the retake hint's closed set (service `pipeline/retake_hint.py`, backend
|
|
663
|
+
* provenance picklist, copy keys `hints.*`): `appearance` (pad, deepfake, temporal signals),
|
|
664
|
+
* `motion` (no parallax or a high motion residual), `lighting` (low face luminance),
|
|
665
|
+
* `framing` (a small or clipped face box).
|
|
666
|
+
*/
|
|
667
|
+
type RetakeHint = "appearance" | "motion" | "lighting" | "framing";
|
|
711
668
|
/**
|
|
712
669
|
* Per-check projection in a {@link HostedSessionView} — the spec'd hosted step
|
|
713
670
|
* shape. NEVER carries `calibratedScore` or the raw check `outputs`; the only
|
|
@@ -719,6 +676,12 @@ interface HostedStepView {
|
|
|
719
676
|
state: CheckState;
|
|
720
677
|
/** Frozen-taxonomy reason code explaining a `failed`/`review` state. */
|
|
721
678
|
reason?: CheckReason;
|
|
679
|
+
/**
|
|
680
|
+
* Liveness v7 §5.2: what to change for the next capture, on a liveness step parked at
|
|
681
|
+
* `input_required` (the signal that weighed most in the inconclusive score). Absent on older
|
|
682
|
+
* APIs, on decisive results and on the other checks: then the reason's generic copy applies.
|
|
683
|
+
*/
|
|
684
|
+
retakeHint?: RetakeHint;
|
|
722
685
|
/**
|
|
723
686
|
* Spec 2026-10-27: a Sandbox check answered by simulation (no provider or
|
|
724
687
|
* model ran). Absent on Live, on real Sandbox checks and on older APIs.
|
|
@@ -817,6 +780,11 @@ interface HostedBranding {
|
|
|
817
780
|
radius?: "none" | "sm" | "md" | "lg" | "full";
|
|
818
781
|
/** Font choice (system fallbacks when the font is not installed). */
|
|
819
782
|
fontFamily?: "system" | "inter" | "ibm-plex-sans-arabic" | "noto-sans-arabic" | "roboto";
|
|
783
|
+
/**
|
|
784
|
+
* Spec 2026-10-29 D16: the org hides the "Verified by Sekyro AI" attribution (hosted frame and SDK footer).
|
|
785
|
+
* Present (true) only then; absent on older APIs.
|
|
786
|
+
*/
|
|
787
|
+
hideAttribution?: boolean;
|
|
820
788
|
}
|
|
821
789
|
/**
|
|
822
790
|
* Token-addressed hosted-page bootstrap (`GET /hosted/session`). A separate
|
|
@@ -832,7 +800,7 @@ interface HostedBranding {
|
|
|
832
800
|
*/
|
|
833
801
|
interface HostedCaptureTuning {
|
|
834
802
|
tuningVersion?: string;
|
|
835
|
-
liveness?:
|
|
803
|
+
liveness?: HostedLivenessCaptureTuning;
|
|
836
804
|
document?: Record<string, unknown>;
|
|
837
805
|
/** SDK spec §5.4 ID mode: the strict ICAO gate's coaching limits (present with `portrait`). */
|
|
838
806
|
icao?: IcaoCaptureTuning;
|
|
@@ -871,6 +839,91 @@ interface HostedLivePhotoTuning {
|
|
|
871
839
|
jpegQuality: number;
|
|
872
840
|
};
|
|
873
841
|
}
|
|
842
|
+
/**
|
|
843
|
+
* `capture.liveness`: the face gate's coaching values (open; web keeps its built-in v3 values) and, from liveness v7,
|
|
844
|
+
* the screen-ramp challenge the web SDK renders while the clip records.
|
|
845
|
+
*/
|
|
846
|
+
interface HostedLivenessCaptureTuning {
|
|
847
|
+
[field: string]: unknown;
|
|
848
|
+
/**
|
|
849
|
+
* Liveness v7 §4.4: the server-issued screen-ramp challenge of this session. Absent (older backends, assisted
|
|
850
|
+
* sessions, the ramp switched off): no ramp is rendered and the submit carries no `screenRamp`.
|
|
851
|
+
*/
|
|
852
|
+
screenRamp?: ScreenRampChallenge;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* The closed palette of the screen ramp (liveness v7 §4.4). Each name maps to one fixed sRGB value in `@sekyro/web`
|
|
856
|
+
* (`screenRampColourValue`); the service verifies the clip against the same values.
|
|
857
|
+
*/
|
|
858
|
+
type ScreenRampColour = 'rose' | 'peach' | 'sand' | 'mint' | 'sky' | 'lilac';
|
|
859
|
+
/**
|
|
860
|
+
* The screen-ramp challenge issued per session (liveness v7 §4.4, §4.5 item 1): three colours shown for 400 ms each,
|
|
861
|
+
* starting at `onsetsMs[i]` on the clip's own timeline (the backend jitters each onset inside its slot). The layer
|
|
862
|
+
* returns to transparent at 2,000 ms. The client renders exactly this and reports what it rendered
|
|
863
|
+
* ({@link ScreenRampReport}); the backend forwards the issued challenge to the model service.
|
|
864
|
+
*/
|
|
865
|
+
interface ScreenRampChallenge {
|
|
866
|
+
/** Ties the report to the issued challenge (echoed in {@link ScreenRampReport.nonce}). */
|
|
867
|
+
nonce: string;
|
|
868
|
+
colours: [ScreenRampColour, ScreenRampColour, ScreenRampColour];
|
|
869
|
+
/** Whole ms on the clip timeline, ascending, each inside the 800 to 2,000 ms window. */
|
|
870
|
+
onsetsMs: [number, number, number];
|
|
871
|
+
/** The palette the colours were drawn from (informational; the client renders `colours`). */
|
|
872
|
+
palette: ScreenRampColour[];
|
|
873
|
+
}
|
|
874
|
+
/** One rendered colour change: `tMs` on the clip timeline (whole ms, ≥ 0). */
|
|
875
|
+
interface ScreenRampRendered {
|
|
876
|
+
tMs: number;
|
|
877
|
+
colour: ScreenRampColour;
|
|
878
|
+
}
|
|
879
|
+
/** `LivenessCaptureInput.screenRamp`: what the SDK rendered against the issued {@link ScreenRampChallenge}. */
|
|
880
|
+
interface ScreenRampReport {
|
|
881
|
+
nonce: string;
|
|
882
|
+
/** In render order, at most three entries. */
|
|
883
|
+
rendered: ScreenRampRendered[];
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* `LivenessCaptureInput.provenance` (liveness v7 §4.5 item 2): how the web capture was made. Signals only, no media,
|
|
887
|
+
* no raw device identifiers. The backend allowlists it into the capture metadata; the model service turns it into
|
|
888
|
+
* the `virtual_camera | capture_tampered | replay_suspected` signals with its own thresholds and label list.
|
|
889
|
+
*/
|
|
890
|
+
interface CaptureProvenance {
|
|
891
|
+
/** The selected video track's `getSettings()`; `deviceIdHash` is the first 16 hex of SHA-256(deviceId). */
|
|
892
|
+
trackSettings: {
|
|
893
|
+
facingMode?: 'user' | 'environment' | 'left' | 'right';
|
|
894
|
+
frameRate?: number;
|
|
895
|
+
width?: number;
|
|
896
|
+
height?: number;
|
|
897
|
+
deviceIdHash?: string;
|
|
898
|
+
};
|
|
899
|
+
/** `MediaStreamTrack.getCapabilities` exists on this browser (absent on Firefox; virtual stacks often lack it). */
|
|
900
|
+
capabilitiesPresent: boolean;
|
|
901
|
+
/**
|
|
902
|
+
* The track label against the SDK's small list of virtual-camera products (`known_virtual`), the platform's own
|
|
903
|
+
* camera naming (`platform`), or anything else, an empty label included (`unknown`).
|
|
904
|
+
*/
|
|
905
|
+
labelClass: 'known_virtual' | 'unknown' | 'platform';
|
|
906
|
+
/**
|
|
907
|
+
* `requestVideoFrameCallback` statistics over the recording: frames seen, mean and standard deviation of the
|
|
908
|
+
* inter-frame gap (ms), and the mean `presentationTime - captureTime` (ms) when the browser reports `captureTime`
|
|
909
|
+
* (null otherwise). All zero with `n: 0` when the browser has no `requestVideoFrameCallback`.
|
|
910
|
+
*/
|
|
911
|
+
rvfc: {
|
|
912
|
+
n: number;
|
|
913
|
+
meanGapMs: number;
|
|
914
|
+
stdGapMs: number;
|
|
915
|
+
captureLatencyMs: number | null;
|
|
916
|
+
};
|
|
917
|
+
/** `getUserMedia` and `MediaStreamTrack.prototype.getSettings` are still native code (not replaced by a page script). */
|
|
918
|
+
prototypesIntact: boolean;
|
|
919
|
+
/**
|
|
920
|
+
* The engine ran this capture with a screen-ramp painter: a self capture handed the session's challenge with a
|
|
921
|
+
* `ramp` listener bound. `false` for a host that never binds `ramp`, an assisted capture, a keyframe-only capture
|
|
922
|
+
* or a session without a challenge. The backend keys `ramp_missing` on this flag, not on the SDK version: a
|
|
923
|
+
* `true` capture without `screenRamp` is missing, a `false` one is a client without the ramp.
|
|
924
|
+
*/
|
|
925
|
+
rampPainter: boolean;
|
|
926
|
+
}
|
|
874
927
|
/**
|
|
875
928
|
* {@link HostedCaptureTuning} with the native-only document fields typed. The wire shape is
|
|
876
929
|
* the same; `HostedSessionView.capture` stays the open {@link HostedCaptureTuning} so existing
|
|
@@ -947,7 +1000,7 @@ interface HostedSessionView {
|
|
|
947
1000
|
/**
|
|
948
1001
|
* The FIRST allowlisted web-SDK origin of the owning org (Task 12), or null
|
|
949
1002
|
* when none is registered. The hosted page posts the SDK popup postMessage
|
|
950
|
-
* events (event name
|
|
1003
|
+
* events (event name, sessionId and the level when known) to exactly this origin — never `'*'`.
|
|
951
1004
|
* The backend declares it required (`string | null`); optional here so
|
|
952
1005
|
* pre-Task-12 consumers/fixtures stay valid (additive field, always on the
|
|
953
1006
|
* wire from Task 12 onward).
|
|
@@ -1009,6 +1062,15 @@ interface HostedSessionView {
|
|
|
1009
1062
|
* (and on older APIs).
|
|
1010
1063
|
*/
|
|
1011
1064
|
retryAfter?: string;
|
|
1065
|
+
/**
|
|
1066
|
+
* What the session proved, once it is terminal (spec 2026-10-29 §3.2);
|
|
1067
|
+
* `null` while it runs. Absent on older APIs.
|
|
1068
|
+
*/
|
|
1069
|
+
level?: VerificationLevel | null;
|
|
1070
|
+
/** How the level was proved, once terminal; `null` while it runs. Absent on older APIs. */
|
|
1071
|
+
assurance?: VerificationAssurance | null;
|
|
1072
|
+
/** The subject (person) the session is linked to, once known. Absent on older APIs. */
|
|
1073
|
+
subjectId?: string;
|
|
1012
1074
|
/**
|
|
1013
1075
|
* A returning-user session (profile v2 step 5): the person verified before
|
|
1014
1076
|
* and this session only confirms it is still them — liveness and a face
|
|
@@ -1049,6 +1111,26 @@ interface HostedSessionView {
|
|
|
1049
1111
|
plan?: HostedPlanView;
|
|
1050
1112
|
/** Step 2b identity summary, present only while its confirmation is pending. */
|
|
1051
1113
|
identitySummary?: IdentitySummaryView;
|
|
1114
|
+
/**
|
|
1115
|
+
* Spec 2026-10-29 §6.7: the copy set the session's screens use: `human` (the person proves they are a real person:
|
|
1116
|
+
* one intro line, the short Human consent terms) or `identity`. Absent on older APIs: treat as `identity`.
|
|
1117
|
+
*/
|
|
1118
|
+
purpose?: "human" | "identity";
|
|
1119
|
+
/**
|
|
1120
|
+
* Spec 2026-10-29 §3.4: `true` when a flow fallback takes over a missing camera at the live step
|
|
1121
|
+
* (`POST /hosted/camera-unavailable` continues the session instead of ending it). Absent otherwise and on
|
|
1122
|
+
* older APIs. Offer "continue without a camera" only then, or on a `human` session.
|
|
1123
|
+
*/
|
|
1124
|
+
cameraUnavailableHandled?: true;
|
|
1125
|
+
/**
|
|
1126
|
+
* Spec 2026-10-29 D12: where the hosted completion screen sends the person (`returnUrl`, checked at session
|
|
1127
|
+
* create against the app's web origins or native scheme) and the partner's opaque `state`. Never the result.
|
|
1128
|
+
* Absent when the session has no return link (and on older APIs).
|
|
1129
|
+
*/
|
|
1130
|
+
link?: {
|
|
1131
|
+
returnUrl?: string;
|
|
1132
|
+
state?: string;
|
|
1133
|
+
};
|
|
1052
1134
|
}
|
|
1053
1135
|
/** `POST /hosted/consent` result — 201 on first record, 200 `{alreadyRecorded: true}` on replay. */
|
|
1054
1136
|
/**
|
|
@@ -1059,8 +1141,11 @@ type HostedConsentView = HostedSessionView & RecordConsentResult;
|
|
|
1059
1141
|
interface RecordConsentResult {
|
|
1060
1142
|
alreadyRecorded: boolean;
|
|
1061
1143
|
}
|
|
1062
|
-
/**
|
|
1063
|
-
|
|
1144
|
+
/**
|
|
1145
|
+
* Consent locale: the page's `[locale]` URL segment echoed back (HostedConsentSchema picklist). The six end-user
|
|
1146
|
+
* locales (spec 2026-10-29 §9); a backend older than Plan C accepts ar/fr/en only.
|
|
1147
|
+
*/
|
|
1148
|
+
type ConsentLocale = "ar" | "fr" | "en" | "es" | "pt" | "de";
|
|
1064
1149
|
/** Per-check projection in a {@link SessionView} — enum/id only, never civil data. */
|
|
1065
1150
|
interface SessionStepView {
|
|
1066
1151
|
checkType: CheckType;
|
|
@@ -1207,6 +1292,13 @@ interface LivenessCaptureInput {
|
|
|
1207
1292
|
mode?: 'self' | 'assisted';
|
|
1208
1293
|
/** The device kind. With `mode` set, the server applies the upright requirement (`capture_not_upright`) to `phone` only. */
|
|
1209
1294
|
formFactor?: 'phone' | 'tablet' | 'desktop';
|
|
1295
|
+
/**
|
|
1296
|
+
* Liveness v7 §4.5 item 1: the screen ramp the SDK rendered against the session's issued challenge. Absent when no
|
|
1297
|
+
* challenge was issued, in an assisted capture, in a keyframe-only capture, or when no host painted the ramp.
|
|
1298
|
+
*/
|
|
1299
|
+
screenRamp?: ScreenRampReport;
|
|
1300
|
+
/** Liveness v7 §4.5 item 2: how the capture was made. Sent whenever the engine had a camera track. */
|
|
1301
|
+
provenance?: CaptureProvenance;
|
|
1210
1302
|
}
|
|
1211
1303
|
/**
|
|
1212
1304
|
* population_registry adapter input. `nni` is the 10-digit NNI for an UNBOUND
|
|
@@ -1349,422 +1441,11 @@ interface CheckInputByType {
|
|
|
1349
1441
|
*/
|
|
1350
1442
|
interface SubmitCheckBody {
|
|
1351
1443
|
input?: Record<string, unknown>;
|
|
1352
|
-
forceOutcome?: "pass" | "fail";
|
|
1353
|
-
}
|
|
1354
|
-
|
|
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
1444
|
/**
|
|
1663
|
-
*
|
|
1664
|
-
*
|
|
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.
|
|
1445
|
+
* `age_over | age_uncertain | age_under | age_unavailable` (liveness submit only) pick what the age check
|
|
1446
|
+
* (selfie) step that follows the liveness step decides in a sandbox session.
|
|
1667
1447
|
*/
|
|
1668
|
-
|
|
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";
|
|
1448
|
+
forceOutcome?: "pass" | "fail" | "age_over" | "age_uncertain" | "age_under" | "age_unavailable";
|
|
1767
1449
|
}
|
|
1768
|
-
declare function createIcaoGate(t: ResolvedIcaoTuning, options?: IcaoGateOptions): IcaoGate;
|
|
1769
1450
|
|
|
1770
|
-
export { type
|
|
1451
|
+
export { type IdentitySummarySource 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 HostedIcaoPolicy as G, type HostedSessionView as H, type IdentityConfirmDecision as I, type HostedIntegrity as J, type HostedLivePhotoTuning as K, type HostedLivenessCaptureTuning as L, type MediaKind as M, type HostedNativeCaptureTuning as N, type HostedOcrTuning as O, type PresignUploadResult as P, type HostedOtpView as Q, type ResolvedIcaoTuning as R, type ScreenRampColour as S, type HostedPlanView as T, type HostedPortraitView as U, type HostedStepView as V, type HostedVoiceLocale as W, type HostedVoiceView as X, type IcaoCaptureTuning as Y, type IcaoReportEntry as Z, type IdentityMethod as _, type HostedConsentView as a, type IdentitySummaryView as a0, type LivenessReason as a1, type MatchReason as a2, type MethodChoiceView as a3, type NationalEidOption as a4, type NfcChipReason as a5, type NfcStepView as a6, type OtpChoiceView as a7, type PhoneOtpReason as a8, type PlanAttempts as a9, type DocDeviceRead as aA, type DocOcrInput as aB, type DocSide as aC, type EmailOtpInput as aD, type FaceMatchInput as aE, type LivenessCaptureInput as aF, type LivenessInput as aG, type PhoneOtpInput as aH, type PopulationInput as aI, type PresignRequest as aJ, type RecordConsentResult as aK, type SessionStepView as aL, type SessionView as aM, type SubmitCheckBody as aN, type PlanChoiceKind as aa, type PlanChoiceOption as ab, type PlanChoiceView as ac, type PlanSectionView as ad, type PlanStepView as ae, type PolicyFailureReason as af, type PopulationReason as ag, type PortraitIcaoInput as ah, type PortraitIcaoReason as ai, type RetakeHint as aj, type ScreenRampChallenge as ak, type ScreenRampRendered as al, type ScreenRampReport as am, type SessionFailureReason as an, type SessionOutcome as ao, type SessionStatus as ap, type StepSection as aq, type VerificationAssurance as ar, type VerificationLevel as as, ICAO_FALLBACK as at, type IcaoProfile as au, resolveIcaoTuning as av, type PersonMask as aw, type AttestationInput as ax, type CaptureNoncesResult as ay, type CaptureProof 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 AgeEstimationReason as h, type CaptureMode as i, type CaptureProvenance as j, type CheckReason as k, type CheckState as l, type ContactChannel as m, type DocReason as n, type EidAuthInput as o, type EidReason as p, type EmailOtpReason as q, type HostedAcceptedDocuments as r, type HostedBranding as s, type HostedBrandingColorKey as t, type HostedCaptureTuning as u, type HostedDocumentCaptureTuning as v, type HostedDocumentScanTuning as w, type HostedEidView as x, type HostedEmailOtpView as y, type HostedFlowRef as z };
|