@sekyro/web 0.1.0-rc.21 → 0.1.0-rc.22.1
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 +51 -0
- package/README.md +12 -11
- package/dist/background-monitor-GCMNCJMG.js +1 -0
- package/dist/camera-trait-HVV5ZEDI.js +1 -0
- package/dist/{capture-constraints-B5omafmk.d.cts → capture-constraints-CVqpMNGA.d.cts} +7 -3
- package/dist/{capture-constraints-B5omafmk.d.ts → capture-constraints-CVqpMNGA.d.ts} +7 -3
- package/dist/capture-session-doc-VSUEDAEN.js +1 -0
- package/dist/{capture-session-v3-26FgzBIl.d.cts → capture-session-v3-C-Q-21Fm.d.ts} +90 -13
- package/dist/{capture-session-v3-ZO0QOeQH.d.ts → capture-session-v3-DD-MXSU4.d.cts} +90 -13
- package/dist/chunk-6RJTKX5I.js +1 -0
- package/dist/chunk-7KXJEF7P.js +1 -0
- package/dist/chunk-7TGVXBW6.js +1 -0
- package/dist/chunk-ACP2ZOVW.js +1 -0
- package/dist/{chunk-MXWLCDFX.js → chunk-AXJ2VWIK.js} +1 -1
- package/dist/chunk-CDDYFUER.js +1 -0
- package/dist/chunk-CPK5FYNJ.js +1 -0
- package/dist/{chunk-G6LKLN4U.js → chunk-EKEHAFEK.js} +1 -1
- package/dist/{chunk-QYYJLXKA.js → chunk-FSJPKOCC.js} +1 -1
- package/dist/chunk-H6REKPZ4.js +1 -0
- package/dist/{chunk-A3FUGHAH.js → chunk-HFCVN6AG.js} +1 -1
- package/dist/chunk-J5IQ6THP.js +1 -0
- package/dist/chunk-NHXLIDQJ.js +1 -0
- package/dist/chunk-PVSYKKMP.js +1 -0
- package/dist/chunk-RJZ5SARR.js +1 -0
- package/dist/chunk-TTD5LQG2.js +1 -0
- package/dist/{chunk-RI3E7GBN.js → chunk-TYJA2XJR.js} +1 -1
- package/dist/chunk-UBRNDTTD.js +1 -0
- package/dist/chunk-V4VFZ7NQ.js +1 -0
- package/dist/chunk-XB4KLBHY.js +1 -0
- package/dist/chunk-XK4CCTLL.js +1 -0
- package/dist/{chunk-33KKMPJ5.js → chunk-XLYHT4ZQ.js} +1 -1
- package/dist/chunk-ZGDUIZC2.js +1 -0
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +1 -1
- package/dist/clip-inspect-HZ7N2YOP.js +1 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +5 -5
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +1 -1
- package/dist/core/ocr/worker.js +1 -1
- package/dist/core/v3/detect-worker.cjs +1 -1
- package/dist/core/v3/detect-worker.d.cts +1 -1
- package/dist/core/v3/detect-worker.d.ts +1 -1
- package/dist/core/v3/detect-worker.js +1 -1
- package/dist/create-document-capture-D7GUVFWF.js +1 -0
- package/dist/create-portrait-capture-VRZZOMJS.js +1 -0
- package/dist/{create-verification-KlHIU4Fy.d.ts → create-verification-BsZ038gI.d.cts} +175 -80
- package/dist/{create-verification-CXhXxknV.d.cts → create-verification-CfSZiPSN.d.ts} +175 -80
- package/dist/{detect-worker-DclNxkZT.d.ts → detect-worker-CHqsPJoM.d.cts} +19 -2
- package/dist/{detect-worker-DclNxkZT.d.cts → detect-worker-CHqsPJoM.d.ts} +19 -2
- package/dist/{detector-scanic-YCDNLCGV.js → detector-scanic-F3Y5X3DF.js} +1 -1
- package/dist/{icao-gate-DI8VePWd.d.ts → icao-gate-BrnPW_gd.d.ts} +1 -1
- package/dist/{icao-gate-DvzOzHq6.d.cts → icao-gate-Bw0Fxd30.d.cts} +1 -1
- package/dist/icao-gate-SO6YJ7RV.js +1 -0
- package/dist/{icao-policy-DztbA50-.d.ts → icao-policy-C14ZKZ7r.d.ts} +2 -2
- package/dist/{icao-policy-MRB8NMAu.d.cts → icao-policy-DcaumEDt.d.cts} +2 -2
- package/dist/icao-tuning-DCZCMCEQ.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +11 -15
- package/dist/index.d.ts +11 -15
- package/dist/index.js +1 -1
- package/dist/internal/index.cjs +1 -1
- package/dist/internal/index.d.cts +52 -33
- package/dist/internal/index.d.ts +52 -33
- package/dist/internal/index.js +1 -1
- package/dist/{landmarker-KB7LVXAU.js → landmarker-3BBP3RBY.js} +1 -1
- package/dist/mrz-band-DCXFWDBD.js +1 -0
- package/dist/plan-runner-5UZYQ2XH.js +1 -0
- package/dist/popup/index.cjs +1 -1
- package/dist/popup/index.d.cts +2 -2
- package/dist/popup/index.d.ts +2 -2
- package/dist/popup/index.js +1 -1
- package/dist/{print-AYSCRSZB.js → print-4WOMNRBE.js} +1 -1
- package/dist/{turnstile-FATNZ4AG.js → turnstile-MX6YN4YH.js} +1 -1
- package/dist/{types-C_XP92JQ.d.ts → types-ChKVytm_.d.cts} +129 -74
- package/dist/{types-C_XP92JQ.d.cts → types-ChKVytm_.d.ts} +129 -74
- package/package.json +1 -1
- package/sbom.cdx.json +10 -10
- package/dist/background-monitor-A7FKJOAG.js +0 -1
- package/dist/camera-trait-45MJTW4K.js +0 -1
- package/dist/capture-session-doc-XBZGXWOP.js +0 -1
- package/dist/chunk-234OZEDB.js +0 -1
- package/dist/chunk-7Q4YPMAF.js +0 -1
- package/dist/chunk-B2X33ZW2.js +0 -1
- package/dist/chunk-CQ7SKLMC.js +0 -1
- package/dist/chunk-FUHDOEBP.js +0 -1
- package/dist/chunk-GT2ZLGF7.js +0 -1
- package/dist/chunk-H3HVCWLF.js +0 -1
- package/dist/chunk-O5WKNZ2C.js +0 -1
- package/dist/chunk-OKWG3PVH.js +0 -1
- package/dist/chunk-P3H3D33O.js +0 -1
- package/dist/chunk-P6UP4UQY.js +0 -1
- package/dist/chunk-SNACCYTL.js +0 -1
- package/dist/chunk-TQB3URP2.js +0 -1
- package/dist/chunk-VIAT4DEA.js +0 -1
- package/dist/chunk-ZADZTM3M.js +0 -1
- package/dist/chunk-ZNIZACXD.js +0 -1
- package/dist/create-document-capture-23R2F47A.js +0 -1
- package/dist/create-portrait-capture-AGFHECK7.js +0 -1
- package/dist/icao-gate-T3BTOKFJ.js +0 -1
- package/dist/icao-tuning-4ETMF53W.js +0 -1
- package/dist/mrz-band-VYHOTDHY.js +0 -1
- package/dist/plan-runner-NUWONT7F.js +0 -1
- /package/dist/{chunk-53POX7U4.js → chunk-25TEJBSB.js} +0 -0
- /package/dist/{chunk-TDLIXFDT.js → chunk-BPKDXDDH.js} +0 -0
- /package/dist/{chunk-FPXL63KZ.js → chunk-FK2DJADA.js} +0 -0
- /package/dist/{chunk-GI3UFGRQ.js → chunk-LL3YYUKR.js} +0 -0
- /package/dist/{chunk-DK5YPBDQ.js → chunk-LYYLXNA4.js} +0 -0
- /package/dist/{chunk-SMKCBUJL.js → chunk-NYRFUVAR.js} +0 -0
- /package/dist/{chunk-POIQGEZM.js → chunk-V5P5P3HY.js} +0 -0
- /package/dist/{chunk-DFTCAWMP.js → chunk-VP37FW6C.js} +0 -0
- /package/dist/{chunk-CJHMFPL6.js → chunk-YH7DR3PF.js} +0 -0
- /package/dist/{keyframe-rank-YAJLYJYF.js → keyframe-rank-R4NPQGN3.js} +0 -0
- /package/dist/{scanic-ml-stub-KW7IZHUT.js → scanic-ml-stub-XPNKT2N3.js} +0 -0
- /package/dist/{segmenter-USLNBX65.js → segmenter-3CVPTZMM.js} +0 -0
- /package/dist/{upload-file-UYXOHCRG.js → upload-file-C4MFKLT3.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @sekyro/web
|
|
2
2
|
|
|
3
|
+
## 0.1.0-rc.22.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixes liveness submissions failing on slow phones because the Turnstile challenge did not finish in time. A challenge now times out after 30 s again (10 s in rc.22). When a challenge fails or times out, the SDK removes the widget and runs the challenge once more on a new one. The submission waits at most 30 s for the token after the uploads finish. If there is still no token, it is sent without one and the server's attestation rules decide; the challenge keeps running, so a retry can use its token.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-rc.22
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- ad0d148: Assisted capture uses the back camera only, on the liveness and the portrait cameras, as self capture uses the front camera only. `switchCamera()` on `LivenessCaptureHandle` and `PortraitCaptureHandle` does nothing and returns `false`, and a `facing` option or `start({ facing })` asking for the other camera is ignored; both log one console warning per handle. Under capture mode `choice` the person still switches the mode (`setCaptureMode`), and the camera follows it. `CapturedPortrait.facingMode` reports the camera the photo was taken with, and the portrait submission sends it as `input.capture.facingMode`. New reason `capture_front_camera` on `LivenessReason` and `PortraitIcaoReason`: an assisted capture reported on the front camera is refused before scoring, retryable, not billed and not counted as an attempt (in `RETRYABLE_REASONS`).
|
|
14
|
+
|
|
15
|
+
`@sekyro/react`: the front/back camera choice before an assisted capture and the flip button on the liveness and portrait cameras are gone. `IntroContext` no longer has `setFacing` or `canChooseFacing`; `IntroContext.facing` is the capture mode's camera. The new `reasons.capture_front_camera` string comes in every language.
|
|
16
|
+
- ad0d148: Under capture mode `choice` the person switches between filming themselves and being filmed on the camera view. `LivenessCaptureHandle.canSwitchCaptureMode()` says whether the switch is offered (a device with a front and a back camera), and `LivenessCaptureHandle.setCaptureMode(mode)` switches: the pick is recorded for the session (`Verification.chooseCaptureMode`), a running take restarts in the new mode (the recording is dropped, never submitted, and `CaptureState` passes through `mode_switch`), and the camera reopens on the front camera for `self` and the back one for `assisted`. The mode sets the camera.
|
|
17
|
+
|
|
18
|
+
`@sekyro/react`: `<LivenessCapture>` no longer asks who films before the liveness camera opens. Under `choice` the stage shows a chip in its end corner ("Someone is helping me", then "I film myself") that switches the mode and restarts the take with a "Camera switched" status line; a one-camera device does not show it. The new `capture.modeSwitch.*` strings come in every language. The portrait step keeps its who-takes-the-photo question.
|
|
19
|
+
- ad0d148: Every camera step hands off to a phone on a desktop browser, in every decision mode. `deriveStep` turns a `doc_ocr` or `portrait_icao` step that `requiresMobile` with the camera as its source into the `mobile_required` step (`MobileRequiredSnapshot.checkType` gains `doc_ocr` and `portrait_icao`); a `choice` photo step stays on the desktop with `photo.cameraOnPhone: true`, its upload offered and `refresh()` on the document and portrait handles. `Verification.mobileRequired()` covers every camera step. Under capture mode `choice`, `HostedCaptureTuning.pick` is the session's latest mode and the cameras open in it (`Verification.captureChoice` reports it). `detectFormFactor()` reads Windows and ChromeOS touch devices as desktops; iPadOS stays a tablet; a browser whose client hints (`navigator.userAgentData`) say `mobile` or an Android, iOS or iPadOS platform is never a desktop, so an Android phone in "desktop site" mode (a Windows user agent) is not handed off. The reason `uncalibrated_capture_channel` is gone from `LivenessReason`; `@sekyro/react` keeps its `reasons.uncalibrated_capture_channel` wording and `Strings` entry, frozen in the 0.1 dictionaries, though no reason resolves to it.
|
|
20
|
+
|
|
21
|
+
`@sekyro/react`: `<SekyroVerification>` shows the QR of `handoffUrl` at a camera document or portrait step, with a line that says what the phone is for; a `choice` photo step offers "Continue on my phone" and "Upload a photo", and never opens the webcam. Each of these hand-overs, and the liveness hand-over, uses the styled QR code with the Sekyro AI mark in the centre at error correction level H, like the QR codes in the dashboard. The code no longer shows your branding logo, with or without one in your session branding; the rest of the page keeps your branding. The code stays navy on a white tile, in dark mode and under your branding colours.
|
|
22
|
+
- 0804d05: Only one person may be in the liveness video. The capture gate reads the faces its detector already finds (no new model): while another face has at least a quarter of the person's face area, the gate waits (progress drains, the clip never starts) with the new hint `one_face` on `GateHint` and resumes once one face remains. Smaller faces further back never block. The native `FaceDetector` tier now asks for up to four faces and takes the largest as the person. New reason `multiple_faces` on `LivenessReason`: the server saw a second person in the clip and asks for a new one; retryable, not billed and not counted as an attempt for up to 5 retakes per step (in `RETRYABLE_REASONS`).
|
|
23
|
+
|
|
24
|
+
`@sekyro/react`: new strings `fcv3.one_face` (the guidance line, also spoken by the device voice) and `reasons.multiple_faces` (the retake line) in every language; `hintStringKey("one_face")` and `VOICE_KEYS` include it.
|
|
25
|
+
- ad0d148: The portrait step switches the capture mode on its camera too, under capture mode `choice`. `PortraitCaptureHandle.canSwitchCaptureMode()` and `PortraitCaptureHandle.setCaptureMode(mode)` work as on the liveness handle: the pick is recorded for the session, the camera reopens in the new mode (front for `self`, back for `assisted`) with the gate from zero, and `PortraitCaptureState` passes through `mode_switch`. Before the photo is taken only.
|
|
26
|
+
|
|
27
|
+
`@sekyro/react`: the portrait camera opens on the person's pick (`self` before one) with the switch chip in its end corner ("Someone is helping me", then "I take the photo myself") and a "Camera switched" line; a one-camera device does not show it. The who-takes-the-photo question is gone, and with it `CaptureModePicker` and the `capture.modePicker.*` strings; the new `capture.modeSwitch.*Photo` strings come in every language.
|
|
28
|
+
- f4840d7: `FaceMatchReason` no longer has `prior_review_rejected`: an earlier review is reused only when it approved the match, so a face match step never ends with that reason.
|
|
29
|
+
- 2beba0c: `PopulationReason` no longer has `result_from_cache`: a passed registry step carries no reason. `@sekyro/react` drops its wording (`reasons.result_from_cache`) in every language.
|
|
30
|
+
|
|
31
|
+
An object literal that overrides `reasons.result_from_cache` (for example the strings passed to `resolveStrings` or a custom dictionary typed with the package's strings type) must drop that key, or TypeScript reports an unknown property.
|
|
32
|
+
- 5329680: Screen ramp v2 (the liveness colour flash). The palette is four saturated colours, `magenta`, `yellow`, `green` and `blue` (`ScreenRampColour`); the six pastel names are gone. `ScreenRampChallenge` now carries `holdMs`, `endMs` and `clipMs`, and up to eight colours: the engine paints each colour at its onset, black after `holdMs` when the hold is shorter than the slot, and clears the layer at `endMs`. A capture that applies the ramp records the challenge's `clipMs` (3.0 s as issued, a 2.5 s clip otherwise) instead of 2.5 s. The `ramp` event's `colour` is a `ScreenRampPaint`: a colour, `"dark"` or `null`; `screenRampColourValue("dark")` is black. `SCREEN_RAMP_END_MS` and `SCREEN_RAMP_SEGMENT_MS` are removed (the challenge carries the timing). A challenge in the old shape is ignored: no ramp, the default clip.
|
|
33
|
+
- c5b46c4: A finished session is `verified` or `not_verified`. `SessionStatus` is `created | in_progress | review_pending | verified | not_verified`. A `not_verified` session says why in `reason` (`rejected`, `inconclusive`, `unavailable`, `abandoned`, `not_opened`, `policy`, `cancelled`, `superseded`), with the detailed code in `reasonCode`, who or what closed it in `closedBy` and the deciding step in `step`. Plan steps carry `result` (`passed`, `rejected`, `inconclusive`, `unreadable`, `unavailable`, `review`) next to `attempts { used, max }`.
|
|
34
|
+
|
|
35
|
+
`VerificationResult.status` is `verified | not_verified | review | retry | unavailable`. `reason` is the session reason and the check or SDK code is `reasonCode`. A capture refused while the session stays open (`autoRetry` off, or no try left) is `not_verified` with the reason its step result gives. A parked step with tries left is a `retry`, and a step the service could not run is `unavailable`.
|
|
36
|
+
|
|
37
|
+
The result step's `display` is `verified`, `review`, `rejected`, `inconclusive`, `unavailable`, `expired`, `policy`, `cooldown` or `platform_unsupported`. `ResultSnapshot` carries `reason`, `reasonCode` and `step`. The popup events are `session.verified`, `session.not_verified`, `session.review_pending` and `session.cancelled`.
|
|
38
|
+
|
|
39
|
+
Removed: `HostedSessionView.outcome` and `failureReason`, `SessionOutcome`, `PolicyFailureReason`, `HostedStepView.attemptsExhausted` (`attempts.used >= attempts.max` says it) and `ResultSnapshot.failureReason`. `CheckReason` gains `review_timeout` and `inference_unavailable`.
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- 37a6305: Assisted capture asks for the back camera exactly (`facingMode: { exact: "environment" }`), then a back lens by `deviceId`, then the browser's own pick, on the liveness and the portrait cameras. When only the front camera opens, nothing is recorded or uploaded: under capture mode `choice` the take continues as a self capture on the front camera (the pick is recorded and the stage shows the mode switch), otherwise the capture fails with `kind: "notfound"` and `detail.engineKind: "backcamera"`. Before this, a browser could answer the back-camera request with the front camera, and the server refused the uploaded clip with `capture_front_camera`.
|
|
44
|
+
|
|
45
|
+
`@sekyro/react`: the camera error notice shows the new `fcv2.err.backcamera` string for that failure, in every language.
|
|
46
|
+
- 960f295: Capture provenance reads the iPhone's camera names in the device language. `labelClass` was `unknown` for every iPhone set to Arabic, French, Spanish, Portuguese or German (`الكاميرا الأمامية`, `Caméra avant`, `Cámara frontal`, `Câmera frontal`, `Frontkamera` and their back-camera names). These now read as `platform`, like `Front Camera`. The label is still classified on the device and never sent. The field stays a recorded signal and decides nothing.
|
|
47
|
+
- ab329bc: The portrait and document steps no longer hand out a camera handle that was destroyed. A camera view that unmounts and mounts again on the same `<video>` (React StrictMode in development, or a remount) used to get the cached, destroyed handle back. Its `start()` did nothing, so the camera never appeared. It now gets a new handle.
|
|
48
|
+
- f8eae5a: The document step returns to the camera when the server asks for a retake of a passport page (`doc_ocr` `input_required` with `unreadable` or any other retryable reason). Before, the one-face read was settled as accepted and the camera stayed on the read screen with no way forward; a card whose two faces were both in but still asked for again did the same. Both now re-read the face that was sent. `@sekyro/react`: the retake line over the camera shows the server's reason, as the native SDKs do; a re-read the device asks for by itself keeps the re-read line.
|
|
49
|
+
- 704e58a: Liveness clips now cover their full window on Android browsers. The recording stops once the camera has presented `clipMs` of frames after the recorder started, plus 100 ms for the encoder to hand over the last frame (hard cap `clipMs` + 700 ms), instead of on a timer from `start()`. Browsers without an MP4 recorder (Chromium before 126) record H.264 in WebM on the hardware encoder before VP8 and VP9, and Chromium 126 skips its MP4 recorder. Every finished clip is measured from its container, a Chromium WebM gets the Duration its muxer leaves out, and a clip more than 100 ms short, unreadable or failed by the recorder is recorded once more, silently, then the better take is sent. `CapturedArtifacts` gains `clipFrames`, `fps`, `clipRetakes` and `codec`; `clipMs` is the measured clip length when the container was read. The liveness submission sends them in `input.capture`.
|
|
50
|
+
- 59b610b: A liveness capture made in a desktop browser is never uploaded or submitted, in every decision mode: the verification continues on a phone through the QR code. The device header now also reports the screen's touch points, so the server can tell a tablet that sends a desktop user agent (iPadOS Safari, Android "desktop site") from a desktop.
|
|
51
|
+
- 745caf9: Every hosted API call sends the browser's form factor in the `sekyro-client-form-factor` header (`desktop`, `phone` or `tablet`, from `detectFormFactor()`). The server reads it only to record where a session started and continued when its own request headers cannot tell (Safari or Firefox on a Mac, an iPad); it never decides whether a camera capture is accepted.
|
|
52
|
+
- 1d7ee00: The liveness submission waits less for its Turnstile token, and the consent is recorded when the person taps Continue. When the camera starts and the face capture is the next step, `createVerification` records the consent (the person's first action, spec §3.7) instead of just before the uploads; nothing else is submitted then, and a failed call is made again before the first submission. `createVerification` requests the token when the camera starts (and when consent is recorded), so the challenge runs while the person films, and submits it if it is less than 240 s old (Cloudflare accepts a token for 300 s); a token that is older, or a prefetch that failed, is replaced by a fresh one. One invisible widget per site key is rendered and kept: a later token is `reset()` and `execute()` on the same widget instead of a new widget each time. A challenge now times out after 10 s instead of 30 s; the submission still retries once. `input.capture.attestationMs` reports how long the token took once the uploads had settled.
|
|
53
|
+
|
|
3
54
|
## 0.1.0-rc.21
|
|
4
55
|
|
|
5
56
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -17,9 +17,11 @@ Use of the SDK is governed by the [Sekyro AI SDK License](https://sekyro.ai/lega
|
|
|
17
17
|
import { createVerification } from "@sekyro/web";
|
|
18
18
|
|
|
19
19
|
const v = createVerification({ clientToken, locale: "ar" }); // token from your server (@sekyro/node)
|
|
20
|
-
v.on("result", ({ status, reason }) => {
|
|
21
|
-
//
|
|
22
|
-
//
|
|
20
|
+
v.on("result", ({ status, reason, reasonCode }) => {
|
|
21
|
+
// verified | not_verified | review | retry | unavailable: for display.
|
|
22
|
+
// not_verified says why in `reason` (rejected, inconclusive, unavailable, abandoned,
|
|
23
|
+
// not_opened, policy, cancelled, superseded) and the detail in `reasonCode`.
|
|
24
|
+
// The verdict that counts is read server-side (sessions.get + webhooks).
|
|
23
25
|
});
|
|
24
26
|
const cap = v.liveness({ video }); // your <video playsinline muted>
|
|
25
27
|
cap.on("gate", ({ progress, hint }) => {/* ring 0..1, hint code */});
|
|
@@ -79,13 +81,12 @@ await cap.start({ facing: "user" }); // reuses the warm detector automatically
|
|
|
79
81
|
emits the current state first, then every change; `queryCameraPermission` is the
|
|
80
82
|
one-shot read. Both report `'unknown'` where the Permissions API cannot tell.
|
|
81
83
|
- The session decides who films the face (`HostedSessionView.capture.mode`, a flow
|
|
82
|
-
setting), read from `handle.captureMode
|
|
83
|
-
every `createLivenessCapture()` not bound to a session)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
retries and `switchCamera()` flips it (returns `true`).
|
|
84
|
+
setting), read from `handle.captureMode`, and the mode sets the camera. A **self**
|
|
85
|
+
capture (the default, and every `createLivenessCapture()` not bound to a session)
|
|
86
|
+
uses the front camera only; an **assisted** capture (an agent films the person) the
|
|
87
|
+
back camera only. A `facing` asking for the other camera is ignored and
|
|
88
|
+
`switchCamera()` returns `false`, with a console warning; `handle.facingMode`
|
|
89
|
+
reports the camera the stream actually uses.
|
|
89
90
|
- On a phone the camera must be held upright: a landscape frame holds the gate
|
|
90
91
|
(hint `upright`), and turning the phone sideways while the clip records drops that
|
|
91
92
|
clip and goes back to positioning. Tablets and desktop webcams are not affected.
|
|
@@ -109,7 +110,7 @@ import { openHosted } from "@sekyro/web";
|
|
|
109
110
|
const popup = openHosted(hostedUrl, {
|
|
110
111
|
mode: "popup",
|
|
111
112
|
onEvent: ({ event, sessionId }) => {
|
|
112
|
-
// session.
|
|
113
|
+
// session.verified | session.not_verified | session.review_pending | session.cancelled
|
|
113
114
|
// A hint only: read the session on your server (sessions.get) before deciding.
|
|
114
115
|
},
|
|
115
116
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-TYJA2XJR.js";import"./chunk-LL3YYUKR.js";export{a as createBackgroundMonitor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"./chunk-XB4KLBHY.js";export{a as bounded,c as cameraHash,b as hex16,d as noteCameraTrait};
|
|
@@ -18,9 +18,13 @@ declare const PHONE_MAX_SHORT_SIDE = 600;
|
|
|
18
18
|
* - phone: an iPhone / iPod user agent, an Android user agent with `Mobile`, a legacy mobile user agent, or a touch
|
|
19
19
|
* device with a coarse primary pointer whose shorter screen side is under {@link PHONE_MAX_SHORT_SIDE} CSS px;
|
|
20
20
|
* - tablet: iPadOS (an iPad user agent, or the desktop `Macintosh` one with touch points), Android without `Mobile`,
|
|
21
|
-
* and other touch devices with a coarse primary pointer (
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* and other touch devices with a coarse primary pointer (a Linux user agent: an Android phone in "desktop site"
|
|
22
|
+
* mode sends one);
|
|
23
|
+
* - not a desktop whenever UA-CH (`navigator.userAgentData`) says `mobile` or an Android / iOS / iPadOS platform (an
|
|
24
|
+
* Android phone in "desktop site" mode sends a Windows user agent): a phone or tablet by its screen side;
|
|
25
|
+
* - desktop: everything else, Windows and ChromeOS touch devices included (spec 2026-11-06 §9 Q1: the liveness band
|
|
26
|
+
* is calibrated on phones, and the server classifies their requests as desktops). The window width plays no part:
|
|
27
|
+
* a narrow desktop window is still a desktop.
|
|
24
28
|
* SSR-safe (`desktop` without window / navigator).
|
|
25
29
|
*/
|
|
26
30
|
declare function detectFormFactor(): FormFactor;
|
|
@@ -18,9 +18,13 @@ declare const PHONE_MAX_SHORT_SIDE = 600;
|
|
|
18
18
|
* - phone: an iPhone / iPod user agent, an Android user agent with `Mobile`, a legacy mobile user agent, or a touch
|
|
19
19
|
* device with a coarse primary pointer whose shorter screen side is under {@link PHONE_MAX_SHORT_SIDE} CSS px;
|
|
20
20
|
* - tablet: iPadOS (an iPad user agent, or the desktop `Macintosh` one with touch points), Android without `Mobile`,
|
|
21
|
-
* and other touch devices with a coarse primary pointer (
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* and other touch devices with a coarse primary pointer (a Linux user agent: an Android phone in "desktop site"
|
|
22
|
+
* mode sends one);
|
|
23
|
+
* - not a desktop whenever UA-CH (`navigator.userAgentData`) says `mobile` or an Android / iOS / iPadOS platform (an
|
|
24
|
+
* Android phone in "desktop site" mode sends a Windows user agent): a phone or tablet by its screen side;
|
|
25
|
+
* - desktop: everything else, Windows and ChromeOS touch devices included (spec 2026-11-06 §9 Q1: the liveness band
|
|
26
|
+
* is calibrated on phones, and the server classifies their requests as desktops). The window width plays no part:
|
|
27
|
+
* a narrow desktop window is still a desktop.
|
|
24
28
|
* SSR-safe (`desktop` without window / navigator).
|
|
25
29
|
*/
|
|
26
30
|
declare function detectFormFactor(): FormFactor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as b,B as c,C as d,D as e,E as f,F as g,G as h,H as i,I as j,J as k,z as a}from"./chunk-H6REKPZ4.js";import"./chunk-EKEHAFEK.js";import"./chunk-NYRFUVAR.js";import"./chunk-AXJ2VWIK.js";import"./chunk-BPKDXDDH.js";import"./chunk-V5P5P3HY.js";import"./chunk-7KXJEF7P.js";import"./chunk-FK2DJADA.js";import"./chunk-XK4CCTLL.js";import"./chunk-LYYLXNA4.js";export{k as CAPTURE_CANDIDATE_SPACING_MS,j as CAPTURE_EXTRA_CANDIDATES,h as CaptureSessionDoc,c as DOC_BLACK_FRAME_LUMA,d as DOC_BLACK_FRAME_TICKS,e as DOC_CADENCE_HZ,b as DOC_FIRST_FRAME_MS,f as DOC_SHUTTER_DEFAULTS,i as passportBandOf,g as resolveDocShutterTuning,a as warmDocDetector};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { F as FaceObservation, b as Detector, W as WorkerLike } from './detect-worker-
|
|
1
|
+
import { aX as ScreenRampReport, aO as CaptureProvenance, aU as ScreenRampChallenge, aV as ScreenRampPaint } from './types-ChKVytm_.js';
|
|
2
|
+
import { F as FaceObservation, b as Detector, W as WorkerLike } from './detect-worker-CHqsPJoM.js';
|
|
3
3
|
|
|
4
4
|
/** MP4-first ladder: one container (H.264 MP4) covers iOS/macOS Safari + Chrome 130+.
|
|
5
5
|
* WebM/VP9→VP8 only as the Firefox/older-Chromium fallback. */
|
|
@@ -29,19 +29,60 @@ declare function buildLivenessV2FormData(args: {
|
|
|
29
29
|
ts?: number;
|
|
30
30
|
}): FormData;
|
|
31
31
|
|
|
32
|
+
interface ClipStats {
|
|
33
|
+
container: "mp4" | "webm";
|
|
34
|
+
/** Video frames (samples / blocks) in the clip. */
|
|
35
|
+
frames: number;
|
|
36
|
+
/** Video duration in ms: the sample durations (MP4), or the first-to-last frame span plus one frame (WebM). */
|
|
37
|
+
durationMs: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
declare const CLIP_MS = 2500;
|
|
33
41
|
declare const TIMESLICE_MS = 1000;
|
|
34
42
|
declare const STOP_GRACE_MS = 1500;
|
|
35
43
|
declare const VIDEO_BPS = 2500000;
|
|
44
|
+
/** After the frame clock has covered the window: time for the encoder to hand over the last frames before stop(). */
|
|
45
|
+
declare const ENCODER_TAIL_MS = 100;
|
|
46
|
+
/** Hard cap past `clipMs` (from start()) when the frame clock is slow or stalls. */
|
|
47
|
+
declare const MAX_OVERRUN_MS = 700;
|
|
48
|
+
/** How often the frame clock is read while recording. */
|
|
49
|
+
declare const FRAME_POLL_MS = 20;
|
|
50
|
+
/** How long a finished clip waits for the container reader chunk before it ships unmeasured. */
|
|
51
|
+
declare const INSPECT_WAIT_MS = 1500;
|
|
52
|
+
/** The preview's frame clock: the latest presented frame (`performance.now()` domain), null before the first. */
|
|
53
|
+
interface FrameClock {
|
|
54
|
+
latest(): {
|
|
55
|
+
presentationTimeMs: number;
|
|
56
|
+
} | null;
|
|
57
|
+
}
|
|
36
58
|
type ClipErrorKind = CameraErrorKind | "cliptoolarge";
|
|
37
59
|
declare class ClipError extends Error {
|
|
38
60
|
kind: ClipErrorKind;
|
|
61
|
+
/** The type the recorder was asked for when it failed (set by record()). */
|
|
62
|
+
requestedMimeType?: string;
|
|
39
63
|
constructor(kind: ClipErrorKind, msg?: string);
|
|
40
64
|
}
|
|
65
|
+
/** A clip this much shorter than its window is recorded again (once). */
|
|
66
|
+
declare const SHORT_CLIP_TOLERANCE_MS = 100;
|
|
67
|
+
/** A measured clip under `windowMs - SHORT_CLIP_TOLERANCE_MS`, or one whose container could not be read. An
|
|
68
|
+
* unmeasured clip (`stats` absent: a host-supplied recorder) never is. Low frame rate alone is not a reason:
|
|
69
|
+
* a second take on the same encoder would not raise it. */
|
|
70
|
+
declare function needsRetake(clip: Pick<ClipResult, "stats">, windowMs: number): boolean;
|
|
71
|
+
/** `candidate` is the better clip: readable over unreadable, then the longer one. */
|
|
72
|
+
declare function betterTake(candidate: Pick<ClipResult, "stats">, current: Pick<ClipResult, "stats">): boolean;
|
|
41
73
|
interface ClipResult {
|
|
42
74
|
blob: Blob;
|
|
43
75
|
/** Container mime the clip was finalized with (recorder.mimeType || picked || DEFAULT_CLIP_MIME). */
|
|
44
76
|
mimeType: string;
|
|
77
|
+
/** The type the recorder was asked for ("" = the browser default): what a failed take notes as failed. */
|
|
78
|
+
requestedMimeType?: string;
|
|
79
|
+
/** Frames and duration read from the finished container; `null` when it could not be read (a broken clip),
|
|
80
|
+
* absent when the clip was not measured (a host-supplied recorder). */
|
|
81
|
+
stats?: ClipStats | null;
|
|
82
|
+
}
|
|
83
|
+
interface ClipRecorderOptions {
|
|
84
|
+
/** Clock in the frame clock's domain (default `performance.now()`); tests inject it. */
|
|
85
|
+
now?: () => number;
|
|
45
86
|
}
|
|
46
87
|
declare class ClipRecorder {
|
|
47
88
|
private recorder;
|
|
@@ -50,7 +91,10 @@ declare class ClipRecorder {
|
|
|
50
91
|
private bytes;
|
|
51
92
|
private hardStopTimer;
|
|
52
93
|
private graceTimer;
|
|
94
|
+
private pollTimer;
|
|
53
95
|
private settled;
|
|
96
|
+
private readonly now;
|
|
97
|
+
constructor(options?: ClipRecorderOptions);
|
|
54
98
|
private clearTimers;
|
|
55
99
|
/** Records CLIP_MS of the stream. Resolves with the clip blob + its container mime;
|
|
56
100
|
* rejects with ClipError. Behavior contract is the v1 hook's `start`, verbatim
|
|
@@ -74,8 +118,14 @@ declare class ClipRecorder {
|
|
|
74
118
|
* `start` event: the zero of the clip's own timeline, which the screen ramp
|
|
75
119
|
* stamps its colour changes against. PURE NOTIFICATION as well (the
|
|
76
120
|
* `onstart` handler was unset before; nothing else changes), so it is
|
|
77
|
-
* calibration-neutral. Never fires when construction or `start()` failed.
|
|
78
|
-
|
|
121
|
+
* calibration-neutral. Never fires when construction or `start()` failed.
|
|
122
|
+
*
|
|
123
|
+
* `clipMs` (optional) is the recording window, CLIP_MS (2.5 s) by default; a screen-ramp capture passes the
|
|
124
|
+
* challenge's `clipMs` (same 4th parameter as the ramp-v2 change). `frames` (optional) is the preview's frame
|
|
125
|
+
* clock: with it the window is measured on presented frames from the recorder's start (see the header), without
|
|
126
|
+
* it the v1 wall-clock stop at `clipMs` applies. The resolved clip carries its measured `stats`. */
|
|
127
|
+
record(stream: MediaStream, onStopped?: () => void, onStarted?: () => void, clipMs?: number, frames?: FrameClock): Promise<ClipResult>;
|
|
128
|
+
private recordRaw;
|
|
79
129
|
/** Idempotent teardown: stop recorder + ALL tracks (v1 `stopAndCleanup` + the unmount
|
|
80
130
|
* effect). Optional `stream` override mirrors v1's `stopAndCleanup(stream?)`.
|
|
81
131
|
*
|
|
@@ -102,8 +152,10 @@ type CaptureState = "idle" | "preflight" | "acquiring" | "positioning" | "record
|
|
|
102
152
|
* - 'cliptoolarge' the 8 MB clip cap (shared with the liveness API contract)
|
|
103
153
|
* - 'recorder' MediaRecorder failed mid-clip. ClipRecorder's v1-verbatim kind for
|
|
104
154
|
* this is 'generic'; CaptureSession REMAPS it to 'recorder' so hosts
|
|
105
|
-
* can distinguish recorder failure from camera 'generic'.
|
|
106
|
-
|
|
155
|
+
* can distinguish recorder failure from camera 'generic'.
|
|
156
|
+
* - 'backcamera' the back camera was asked for (assisted capture) and only the front
|
|
157
|
+
* one opened: nothing is recorded (the server refuses such a clip). */
|
|
158
|
+
type CaptureErrorKind = CameraErrorKind | "models" | "cliptoolarge" | "recorder" | "backcamera";
|
|
107
159
|
/** The five v1 gate checks (hysteresis-smoothed statuses). */
|
|
108
160
|
interface GateChecks {
|
|
109
161
|
faceDetected: boolean;
|
|
@@ -135,6 +187,10 @@ interface CaptureArtifacts {
|
|
|
135
187
|
clip?: Blob;
|
|
136
188
|
/** Container mime the clip finalized with. Absent in photo mode. */
|
|
137
189
|
clipMimeType?: string;
|
|
190
|
+
/** The clip's frames and duration read from its container (absent when unread or in photo mode). */
|
|
191
|
+
clipStats?: ClipStats;
|
|
192
|
+
/** Silent re-recordings this clip took (0 or 1; absent in photo mode). */
|
|
193
|
+
clipRetakes?: number;
|
|
138
194
|
/** JPEG keyframe (captureMirroredKeyframe): mirrored on the front camera, as the sensor sees it on the back one. */
|
|
139
195
|
keyframe: Blob;
|
|
140
196
|
/** JPEG data URL of the keyframe canvas (v1 preview, quality 0.92). */
|
|
@@ -235,7 +291,7 @@ interface V3GateTickInput {
|
|
|
235
291
|
frameWidth: number;
|
|
236
292
|
frameHeight: number;
|
|
237
293
|
}
|
|
238
|
-
type V3GateFactor = "presence" | "centering" | "size" | "pose" | "sharpness" | "exposure" | "motion";
|
|
294
|
+
type V3GateFactor = "presence" | "single" | "centering" | "size" | "pose" | "sharpness" | "exposure" | "motion";
|
|
239
295
|
/** Per-tick output — the telemetry + chrome contract. */
|
|
240
296
|
interface V3GateTick {
|
|
241
297
|
at: number;
|
|
@@ -266,7 +322,7 @@ declare class FaceGateV3 {
|
|
|
266
322
|
private geometryOf;
|
|
267
323
|
private motionOf;
|
|
268
324
|
/** Lowest failing factor speaks — fixed priority (diagnostic, incl. light):
|
|
269
|
-
* presence → size → centering → pose → exposure → sharpness → hold.
|
|
325
|
+
* presence → single → size → centering → pose → exposure → sharpness → hold.
|
|
270
326
|
*
|
|
271
327
|
* HONESTY FALLBACK (operator ruling 2026-07-12): when every factor clears
|
|
272
328
|
* its guide threshold but q (= min factor) is still below Q_GOOD — i.e.
|
|
@@ -408,11 +464,11 @@ interface CaptureSessionV3Events {
|
|
|
408
464
|
frozen: {
|
|
409
465
|
previewDataUrl: string;
|
|
410
466
|
};
|
|
411
|
-
/**
|
|
412
|
-
* challenge issued by `screenRamp()
|
|
413
|
-
*
|
|
467
|
+
/** Ramp v2: paint the full-screen screen-ramp layer this colour, black (`"dark"`, the dark-gap arm) or clear it
|
|
468
|
+
* (`null`). Clip mode, a challenge issued by `screenRamp()`. CHROME-only: the host paints, the engine stamps the
|
|
469
|
+
* clip timeline. */
|
|
414
470
|
ramp: {
|
|
415
|
-
colour:
|
|
471
|
+
colour: ScreenRampPaint;
|
|
416
472
|
};
|
|
417
473
|
}
|
|
418
474
|
type V3TelemetryEvent = {
|
|
@@ -430,6 +486,11 @@ type V3TelemetryEvent = {
|
|
|
430
486
|
degradeCount: number;
|
|
431
487
|
meanDetectMs: number;
|
|
432
488
|
}
|
|
489
|
+
/** The first take was short, unreadable or errored: the clip is recorded once more (clip-duration fix). */
|
|
490
|
+
| {
|
|
491
|
+
type: "clip_retake";
|
|
492
|
+
reason: "short" | "unreadable" | "error";
|
|
493
|
+
}
|
|
433
494
|
/** Where the attempt's gate time went (see gate-blocking.ts): per-reason
|
|
434
495
|
* blocked tick counts + ms, accepted ms, and the ACTIVE device class /
|
|
435
496
|
* cadence after any dynamic profile adjustment. `final` on the attempt's
|
|
@@ -500,6 +561,12 @@ interface CaptureSessionV3Options {
|
|
|
500
561
|
createRecorder?: () => Pick<ClipRecorder, "record" | "stop">;
|
|
501
562
|
/** (navigator.mediaDevices.getUserMedia) */
|
|
502
563
|
getUserMedia?: (constraints: MediaStreamConstraints) => Promise<MediaStream>;
|
|
564
|
+
/** (navigator.mediaDevices.enumerateDevices, only when `getUserMedia` is not overridden) — the back lenses by id. */
|
|
565
|
+
enumerateDevices?: () => Promise<ReadonlyArray<{
|
|
566
|
+
deviceId: string;
|
|
567
|
+
label: string;
|
|
568
|
+
kind?: string;
|
|
569
|
+
}>>;
|
|
503
570
|
/** (canvas keyframe, mirrored on the front camera only, + downscaled Laplacian sharpness) */
|
|
504
571
|
captureKeyframe?: (video: HTMLVideoElement) => Promise<KeyframeCandidate>;
|
|
505
572
|
/** (downscaled face-crop sharpness/exposure via canvas) */
|
|
@@ -583,6 +650,11 @@ declare class CaptureSessionV3 {
|
|
|
583
650
|
/** Full reset + camera restart — the documented recovery path (v1 parity). */
|
|
584
651
|
retry(): void;
|
|
585
652
|
switchCamera(): void;
|
|
653
|
+
/**
|
|
654
|
+
* Spec 2026-11-06 §3.3 (the capture mode switch): drop the running attempt (a recording is discarded, never
|
|
655
|
+
* finalized) and start again on `facingMode`.
|
|
656
|
+
*/
|
|
657
|
+
restart(facingMode: "user" | "environment"): void;
|
|
586
658
|
destroy(): void;
|
|
587
659
|
private run;
|
|
588
660
|
/** Chrome hint (Task 11): 'reduced' on LOW even without the media query. */
|
|
@@ -590,6 +662,11 @@ declare class CaptureSessionV3 {
|
|
|
590
662
|
private startScheduler;
|
|
591
663
|
private detectTick;
|
|
592
664
|
private fire;
|
|
665
|
+
/**
|
|
666
|
+
* One recording of `windowMs` on the preview's frame clock, with the screen ramp (when issued) and the upright
|
|
667
|
+
* guard; rejects with the recorder's error. `onStopped` fires the moment the recording ends (before finalize).
|
|
668
|
+
*/
|
|
669
|
+
private recordTake;
|
|
593
670
|
/** `{ provenance }` from the live track's description, the recording's frame statistics and the painter flag; `{}` without a track. */
|
|
594
671
|
private provenance;
|
|
595
672
|
/** A phone showing a landscape frame: the guard holds the gate. */
|
|
@@ -624,4 +701,4 @@ declare class CaptureSessionV3 {
|
|
|
624
701
|
private now;
|
|
625
702
|
}
|
|
626
703
|
|
|
627
|
-
export {
|
|
704
|
+
export { V3_GATE_DEFAULTS as $, GateBlockStats as A, type GateBlockSummary as B, type CameraErrorKind as C, DEFAULT_CLIP_MIME as D, ENCODER_TAIL_MS as E, FRAME_POLL_MS as F, GATE_SNAPSHOT_MS as G, type GateChecks as H, HOLD_UPRIGHT_KEY as I, INSPECT_WAIT_MS as J, KEYFRAME_CANDIDATES as K, KEYFRAME_WINDOW_MS as L, MAX_CLIP_BYTES as M, MAX_OVERRUN_MS as N, MIME_CANDIDATES as O, PROVENANCE_WAIT_MS as P, STOP_GRACE_MS as Q, type V3GateFactor as R, SHORT_CLIP_TOLERANCE_MS as S, TIMESLICE_MS as T, UPRIGHT_WATCH_MS as U, type V3ChecksPayload as V, type V3GateQuality as W, type V3GateThresholds as X, type V3GateTick as Y, type V3GateTickInput as Z, type V3TelemetryEvent as _, CLIP_MS as a, VIDEO_BPS as a0, betterTake as a1, blockReasonOf as a2, buildLivenessV2FormData as a3, cameraPreflight as a4, classifyDevice as a5, extForMime as a6, isClipTooLarge as a7, isMediaRecorderSupported as a8, mapGetUserMediaError as a9, needsRetake as aa, pickMimeType as ab, probeDevice as ac, type EngineErrorDetail as ad, type CaptureArtifacts as b, type CaptureErrorKind as c, type CaptureSessionEvents as d, CaptureSessionV3 as e, type CaptureSessionV3Events as f, type CaptureSessionV3Options as g, type CaptureSessionV3StartOptions as h, type CaptureState as i, type CaptureTiming as j, ClipError as k, type ClipErrorKind as l, ClipRecorder as m, type ClipRecorderOptions as n, type ClipResult as o, DEVICE_PROFILES as p, type DeviceClass as q, type DeviceProbe as r, type DeviceProfile as s, DeviceProfiler as t, type EscalationClipArtifact as u, type EscalationHook as v, FaceGateV3 as w, type FrameClock as x, type GateBlockEntry as y, type GateBlockReason as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { F as FaceObservation, b as Detector, W as WorkerLike } from './detect-worker-
|
|
1
|
+
import { aX as ScreenRampReport, aO as CaptureProvenance, aU as ScreenRampChallenge, aV as ScreenRampPaint } from './types-ChKVytm_.cjs';
|
|
2
|
+
import { F as FaceObservation, b as Detector, W as WorkerLike } from './detect-worker-CHqsPJoM.cjs';
|
|
3
3
|
|
|
4
4
|
/** MP4-first ladder: one container (H.264 MP4) covers iOS/macOS Safari + Chrome 130+.
|
|
5
5
|
* WebM/VP9→VP8 only as the Firefox/older-Chromium fallback. */
|
|
@@ -29,19 +29,60 @@ declare function buildLivenessV2FormData(args: {
|
|
|
29
29
|
ts?: number;
|
|
30
30
|
}): FormData;
|
|
31
31
|
|
|
32
|
+
interface ClipStats {
|
|
33
|
+
container: "mp4" | "webm";
|
|
34
|
+
/** Video frames (samples / blocks) in the clip. */
|
|
35
|
+
frames: number;
|
|
36
|
+
/** Video duration in ms: the sample durations (MP4), or the first-to-last frame span plus one frame (WebM). */
|
|
37
|
+
durationMs: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
declare const CLIP_MS = 2500;
|
|
33
41
|
declare const TIMESLICE_MS = 1000;
|
|
34
42
|
declare const STOP_GRACE_MS = 1500;
|
|
35
43
|
declare const VIDEO_BPS = 2500000;
|
|
44
|
+
/** After the frame clock has covered the window: time for the encoder to hand over the last frames before stop(). */
|
|
45
|
+
declare const ENCODER_TAIL_MS = 100;
|
|
46
|
+
/** Hard cap past `clipMs` (from start()) when the frame clock is slow or stalls. */
|
|
47
|
+
declare const MAX_OVERRUN_MS = 700;
|
|
48
|
+
/** How often the frame clock is read while recording. */
|
|
49
|
+
declare const FRAME_POLL_MS = 20;
|
|
50
|
+
/** How long a finished clip waits for the container reader chunk before it ships unmeasured. */
|
|
51
|
+
declare const INSPECT_WAIT_MS = 1500;
|
|
52
|
+
/** The preview's frame clock: the latest presented frame (`performance.now()` domain), null before the first. */
|
|
53
|
+
interface FrameClock {
|
|
54
|
+
latest(): {
|
|
55
|
+
presentationTimeMs: number;
|
|
56
|
+
} | null;
|
|
57
|
+
}
|
|
36
58
|
type ClipErrorKind = CameraErrorKind | "cliptoolarge";
|
|
37
59
|
declare class ClipError extends Error {
|
|
38
60
|
kind: ClipErrorKind;
|
|
61
|
+
/** The type the recorder was asked for when it failed (set by record()). */
|
|
62
|
+
requestedMimeType?: string;
|
|
39
63
|
constructor(kind: ClipErrorKind, msg?: string);
|
|
40
64
|
}
|
|
65
|
+
/** A clip this much shorter than its window is recorded again (once). */
|
|
66
|
+
declare const SHORT_CLIP_TOLERANCE_MS = 100;
|
|
67
|
+
/** A measured clip under `windowMs - SHORT_CLIP_TOLERANCE_MS`, or one whose container could not be read. An
|
|
68
|
+
* unmeasured clip (`stats` absent: a host-supplied recorder) never is. Low frame rate alone is not a reason:
|
|
69
|
+
* a second take on the same encoder would not raise it. */
|
|
70
|
+
declare function needsRetake(clip: Pick<ClipResult, "stats">, windowMs: number): boolean;
|
|
71
|
+
/** `candidate` is the better clip: readable over unreadable, then the longer one. */
|
|
72
|
+
declare function betterTake(candidate: Pick<ClipResult, "stats">, current: Pick<ClipResult, "stats">): boolean;
|
|
41
73
|
interface ClipResult {
|
|
42
74
|
blob: Blob;
|
|
43
75
|
/** Container mime the clip was finalized with (recorder.mimeType || picked || DEFAULT_CLIP_MIME). */
|
|
44
76
|
mimeType: string;
|
|
77
|
+
/** The type the recorder was asked for ("" = the browser default): what a failed take notes as failed. */
|
|
78
|
+
requestedMimeType?: string;
|
|
79
|
+
/** Frames and duration read from the finished container; `null` when it could not be read (a broken clip),
|
|
80
|
+
* absent when the clip was not measured (a host-supplied recorder). */
|
|
81
|
+
stats?: ClipStats | null;
|
|
82
|
+
}
|
|
83
|
+
interface ClipRecorderOptions {
|
|
84
|
+
/** Clock in the frame clock's domain (default `performance.now()`); tests inject it. */
|
|
85
|
+
now?: () => number;
|
|
45
86
|
}
|
|
46
87
|
declare class ClipRecorder {
|
|
47
88
|
private recorder;
|
|
@@ -50,7 +91,10 @@ declare class ClipRecorder {
|
|
|
50
91
|
private bytes;
|
|
51
92
|
private hardStopTimer;
|
|
52
93
|
private graceTimer;
|
|
94
|
+
private pollTimer;
|
|
53
95
|
private settled;
|
|
96
|
+
private readonly now;
|
|
97
|
+
constructor(options?: ClipRecorderOptions);
|
|
54
98
|
private clearTimers;
|
|
55
99
|
/** Records CLIP_MS of the stream. Resolves with the clip blob + its container mime;
|
|
56
100
|
* rejects with ClipError. Behavior contract is the v1 hook's `start`, verbatim
|
|
@@ -74,8 +118,14 @@ declare class ClipRecorder {
|
|
|
74
118
|
* `start` event: the zero of the clip's own timeline, which the screen ramp
|
|
75
119
|
* stamps its colour changes against. PURE NOTIFICATION as well (the
|
|
76
120
|
* `onstart` handler was unset before; nothing else changes), so it is
|
|
77
|
-
* calibration-neutral. Never fires when construction or `start()` failed.
|
|
78
|
-
|
|
121
|
+
* calibration-neutral. Never fires when construction or `start()` failed.
|
|
122
|
+
*
|
|
123
|
+
* `clipMs` (optional) is the recording window, CLIP_MS (2.5 s) by default; a screen-ramp capture passes the
|
|
124
|
+
* challenge's `clipMs` (same 4th parameter as the ramp-v2 change). `frames` (optional) is the preview's frame
|
|
125
|
+
* clock: with it the window is measured on presented frames from the recorder's start (see the header), without
|
|
126
|
+
* it the v1 wall-clock stop at `clipMs` applies. The resolved clip carries its measured `stats`. */
|
|
127
|
+
record(stream: MediaStream, onStopped?: () => void, onStarted?: () => void, clipMs?: number, frames?: FrameClock): Promise<ClipResult>;
|
|
128
|
+
private recordRaw;
|
|
79
129
|
/** Idempotent teardown: stop recorder + ALL tracks (v1 `stopAndCleanup` + the unmount
|
|
80
130
|
* effect). Optional `stream` override mirrors v1's `stopAndCleanup(stream?)`.
|
|
81
131
|
*
|
|
@@ -102,8 +152,10 @@ type CaptureState = "idle" | "preflight" | "acquiring" | "positioning" | "record
|
|
|
102
152
|
* - 'cliptoolarge' the 8 MB clip cap (shared with the liveness API contract)
|
|
103
153
|
* - 'recorder' MediaRecorder failed mid-clip. ClipRecorder's v1-verbatim kind for
|
|
104
154
|
* this is 'generic'; CaptureSession REMAPS it to 'recorder' so hosts
|
|
105
|
-
* can distinguish recorder failure from camera 'generic'.
|
|
106
|
-
|
|
155
|
+
* can distinguish recorder failure from camera 'generic'.
|
|
156
|
+
* - 'backcamera' the back camera was asked for (assisted capture) and only the front
|
|
157
|
+
* one opened: nothing is recorded (the server refuses such a clip). */
|
|
158
|
+
type CaptureErrorKind = CameraErrorKind | "models" | "cliptoolarge" | "recorder" | "backcamera";
|
|
107
159
|
/** The five v1 gate checks (hysteresis-smoothed statuses). */
|
|
108
160
|
interface GateChecks {
|
|
109
161
|
faceDetected: boolean;
|
|
@@ -135,6 +187,10 @@ interface CaptureArtifacts {
|
|
|
135
187
|
clip?: Blob;
|
|
136
188
|
/** Container mime the clip finalized with. Absent in photo mode. */
|
|
137
189
|
clipMimeType?: string;
|
|
190
|
+
/** The clip's frames and duration read from its container (absent when unread or in photo mode). */
|
|
191
|
+
clipStats?: ClipStats;
|
|
192
|
+
/** Silent re-recordings this clip took (0 or 1; absent in photo mode). */
|
|
193
|
+
clipRetakes?: number;
|
|
138
194
|
/** JPEG keyframe (captureMirroredKeyframe): mirrored on the front camera, as the sensor sees it on the back one. */
|
|
139
195
|
keyframe: Blob;
|
|
140
196
|
/** JPEG data URL of the keyframe canvas (v1 preview, quality 0.92). */
|
|
@@ -235,7 +291,7 @@ interface V3GateTickInput {
|
|
|
235
291
|
frameWidth: number;
|
|
236
292
|
frameHeight: number;
|
|
237
293
|
}
|
|
238
|
-
type V3GateFactor = "presence" | "centering" | "size" | "pose" | "sharpness" | "exposure" | "motion";
|
|
294
|
+
type V3GateFactor = "presence" | "single" | "centering" | "size" | "pose" | "sharpness" | "exposure" | "motion";
|
|
239
295
|
/** Per-tick output — the telemetry + chrome contract. */
|
|
240
296
|
interface V3GateTick {
|
|
241
297
|
at: number;
|
|
@@ -266,7 +322,7 @@ declare class FaceGateV3 {
|
|
|
266
322
|
private geometryOf;
|
|
267
323
|
private motionOf;
|
|
268
324
|
/** Lowest failing factor speaks — fixed priority (diagnostic, incl. light):
|
|
269
|
-
* presence → size → centering → pose → exposure → sharpness → hold.
|
|
325
|
+
* presence → single → size → centering → pose → exposure → sharpness → hold.
|
|
270
326
|
*
|
|
271
327
|
* HONESTY FALLBACK (operator ruling 2026-07-12): when every factor clears
|
|
272
328
|
* its guide threshold but q (= min factor) is still below Q_GOOD — i.e.
|
|
@@ -408,11 +464,11 @@ interface CaptureSessionV3Events {
|
|
|
408
464
|
frozen: {
|
|
409
465
|
previewDataUrl: string;
|
|
410
466
|
};
|
|
411
|
-
/**
|
|
412
|
-
* challenge issued by `screenRamp()
|
|
413
|
-
*
|
|
467
|
+
/** Ramp v2: paint the full-screen screen-ramp layer this colour, black (`"dark"`, the dark-gap arm) or clear it
|
|
468
|
+
* (`null`). Clip mode, a challenge issued by `screenRamp()`. CHROME-only: the host paints, the engine stamps the
|
|
469
|
+
* clip timeline. */
|
|
414
470
|
ramp: {
|
|
415
|
-
colour:
|
|
471
|
+
colour: ScreenRampPaint;
|
|
416
472
|
};
|
|
417
473
|
}
|
|
418
474
|
type V3TelemetryEvent = {
|
|
@@ -430,6 +486,11 @@ type V3TelemetryEvent = {
|
|
|
430
486
|
degradeCount: number;
|
|
431
487
|
meanDetectMs: number;
|
|
432
488
|
}
|
|
489
|
+
/** The first take was short, unreadable or errored: the clip is recorded once more (clip-duration fix). */
|
|
490
|
+
| {
|
|
491
|
+
type: "clip_retake";
|
|
492
|
+
reason: "short" | "unreadable" | "error";
|
|
493
|
+
}
|
|
433
494
|
/** Where the attempt's gate time went (see gate-blocking.ts): per-reason
|
|
434
495
|
* blocked tick counts + ms, accepted ms, and the ACTIVE device class /
|
|
435
496
|
* cadence after any dynamic profile adjustment. `final` on the attempt's
|
|
@@ -500,6 +561,12 @@ interface CaptureSessionV3Options {
|
|
|
500
561
|
createRecorder?: () => Pick<ClipRecorder, "record" | "stop">;
|
|
501
562
|
/** (navigator.mediaDevices.getUserMedia) */
|
|
502
563
|
getUserMedia?: (constraints: MediaStreamConstraints) => Promise<MediaStream>;
|
|
564
|
+
/** (navigator.mediaDevices.enumerateDevices, only when `getUserMedia` is not overridden) — the back lenses by id. */
|
|
565
|
+
enumerateDevices?: () => Promise<ReadonlyArray<{
|
|
566
|
+
deviceId: string;
|
|
567
|
+
label: string;
|
|
568
|
+
kind?: string;
|
|
569
|
+
}>>;
|
|
503
570
|
/** (canvas keyframe, mirrored on the front camera only, + downscaled Laplacian sharpness) */
|
|
504
571
|
captureKeyframe?: (video: HTMLVideoElement) => Promise<KeyframeCandidate>;
|
|
505
572
|
/** (downscaled face-crop sharpness/exposure via canvas) */
|
|
@@ -583,6 +650,11 @@ declare class CaptureSessionV3 {
|
|
|
583
650
|
/** Full reset + camera restart — the documented recovery path (v1 parity). */
|
|
584
651
|
retry(): void;
|
|
585
652
|
switchCamera(): void;
|
|
653
|
+
/**
|
|
654
|
+
* Spec 2026-11-06 §3.3 (the capture mode switch): drop the running attempt (a recording is discarded, never
|
|
655
|
+
* finalized) and start again on `facingMode`.
|
|
656
|
+
*/
|
|
657
|
+
restart(facingMode: "user" | "environment"): void;
|
|
586
658
|
destroy(): void;
|
|
587
659
|
private run;
|
|
588
660
|
/** Chrome hint (Task 11): 'reduced' on LOW even without the media query. */
|
|
@@ -590,6 +662,11 @@ declare class CaptureSessionV3 {
|
|
|
590
662
|
private startScheduler;
|
|
591
663
|
private detectTick;
|
|
592
664
|
private fire;
|
|
665
|
+
/**
|
|
666
|
+
* One recording of `windowMs` on the preview's frame clock, with the screen ramp (when issued) and the upright
|
|
667
|
+
* guard; rejects with the recorder's error. `onStopped` fires the moment the recording ends (before finalize).
|
|
668
|
+
*/
|
|
669
|
+
private recordTake;
|
|
593
670
|
/** `{ provenance }` from the live track's description, the recording's frame statistics and the painter flag; `{}` without a track. */
|
|
594
671
|
private provenance;
|
|
595
672
|
/** A phone showing a landscape frame: the guard holds the gate. */
|
|
@@ -624,4 +701,4 @@ declare class CaptureSessionV3 {
|
|
|
624
701
|
private now;
|
|
625
702
|
}
|
|
626
703
|
|
|
627
|
-
export {
|
|
704
|
+
export { V3_GATE_DEFAULTS as $, GateBlockStats as A, type GateBlockSummary as B, type CameraErrorKind as C, DEFAULT_CLIP_MIME as D, ENCODER_TAIL_MS as E, FRAME_POLL_MS as F, GATE_SNAPSHOT_MS as G, type GateChecks as H, HOLD_UPRIGHT_KEY as I, INSPECT_WAIT_MS as J, KEYFRAME_CANDIDATES as K, KEYFRAME_WINDOW_MS as L, MAX_CLIP_BYTES as M, MAX_OVERRUN_MS as N, MIME_CANDIDATES as O, PROVENANCE_WAIT_MS as P, STOP_GRACE_MS as Q, type V3GateFactor as R, SHORT_CLIP_TOLERANCE_MS as S, TIMESLICE_MS as T, UPRIGHT_WATCH_MS as U, type V3ChecksPayload as V, type V3GateQuality as W, type V3GateThresholds as X, type V3GateTick as Y, type V3GateTickInput as Z, type V3TelemetryEvent as _, CLIP_MS as a, VIDEO_BPS as a0, betterTake as a1, blockReasonOf as a2, buildLivenessV2FormData as a3, cameraPreflight as a4, classifyDevice as a5, extForMime as a6, isClipTooLarge as a7, isMediaRecorderSupported as a8, mapGetUserMediaError as a9, needsRetake as aa, pickMimeType as ab, probeDevice as ac, type EngineErrorDetail as ad, type CaptureArtifacts as b, type CaptureErrorKind as c, type CaptureSessionEvents as d, CaptureSessionV3 as e, type CaptureSessionV3Events as f, type CaptureSessionV3Options as g, type CaptureSessionV3StartOptions as h, type CaptureState as i, type CaptureTiming as j, ClipError as k, type ClipErrorKind as l, ClipRecorder as m, type ClipRecorderOptions as n, type ClipResult as o, DEVICE_PROFILES as p, type DeviceClass as q, type DeviceProbe as r, type DeviceProfile as s, DeviceProfiler as t, type EscalationClipArtifact as u, type EscalationHook as v, FaceGateV3 as w, type FrameClock as x, type GateBlockEntry as y, type GateBlockReason as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as b,d as E,e as H}from"./chunk-ZGDUIZC2.js";var Y=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function _e(e){return Y.has(e)}function ge(e,n,t){let i=n.detail;return{check:e,kind:n.kind,...i?.name!==void 0?{name:i.name}:{},...i?.phase!==void 0?{phase:i.phase}:{},...i?.engineKind!==void 0?{engineKind:i.engineKind}:{},attempt:Math.max(0,Math.min(1e3,t))}}function Ce(){let e=-1,n="";return{note(t){t==="starting"&&n!=="starting"&&(e+=1),n=t},newHandle(){n=""},noteError(){e<0&&(e=0)},get value(){return e}}}var $={document:"document_photo",nfc:"document_chip",population_registry:"national_number",national_eid:"national_eid"};function f(e){return e.plan?.steps??[]}function P(e){return Math.max(0,e.attempts.max-e.attempts.used)}function j(e){let n=e.plan?.choice;return n!==void 0&&e.plan?.current===n.nodeId?n:null}function ke(e){let n=j(e);if(n?.kind!=="identity_method")return null;let t=n.options.map(o=>$[o.service]).filter(o=>o!==void 0),i=n.options.find(o=>o.nationalEid)?.nationalEid;return i?{available:!0,selected:null,options:t,nationalEid:i}:{available:!0,selected:null,options:t}}var z=new Set(["liveness","face_match"]);function _(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}function I(e){return e.status!=="created"&&e.status!=="in_progress"}function V(e){let n=e.plan?.current,t=n==null?void 0:f(e).find(i=>i.id===n);return _(t)?t:void 0}function y(e,n){return f(e).find(t=>t.checkType===n)}function S(e){let n=f(e),t=n.findIndex(i=>i.checkType==="liveness");return n.find((i,o)=>o>t&&i.checkType==="face_match")}function A(e,n){let t=y(n,"liveness")?.state,i=S(n)?.state;return(S(e)?.state??"pending")==="pending"&&(t==="passed"||t==="review")&&i!==void 0&&i!=="pending"&&i!=="skipped"}function x(e,n){let t=new Map(f(e).map(i=>[i.id,i.state]));return f(n).filter(i=>i.checkType==="face_match"&&(t.get(i.id)??"pending")==="pending"&&i.state!=="pending"&&i.state!=="skipped").map(i=>i.id)}var W=/^[0-9a-f]{24}$/i;function g(e){return W.test(e)?`ses_${e}`:e}function k(e,n){let t=g(e);return n===void 0?{sessionId:t,status:"unavailable"}:{sessionId:t,status:"unavailable",reasonCode:n}}function T(e,n,t){let i=g(e);return t===void 0?{sessionId:i,status:n}:{sessionId:i,status:n,reasonCode:t}}function Re(e,n){let t=g(e.sessionId);switch(e.status){case"created":case"in_progress":return Z(e,n);case"verified":return R(e,{sessionId:t,status:"verified"});case"review_pending":return R(e,T(t,"review",L(e,"review")));case"not_verified":return R(e,G(e));default:return R(e,{sessionId:t,status:"not_verified"})}}var X=new Set([0,1,2,3]);function R(e,n){return X.has(e.level)&&(n.level=e.level),typeof e.assurance=="string"&&e.assurance.length>0&&(n.assurance=e.assurance),n}function G(e){let n={sessionId:g(e.sessionId),status:"not_verified"};return e.reason!==void 0&&(n.reason=e.reason),e.reasonCode!==void 0&&(n.reasonCode=e.reasonCode),e.reasonCode==="device_cooldown"&&e.retryAfter!==void 0&&(n.retryAfter=e.retryAfter),n}function J(e){return e==="rejected"?"rejected":e==="unavailable"?"unavailable":"inconclusive"}function Q(e,n){if(n===void 0)return!1;let t=f(n).find(i=>i.id===e.id);return t!==void 0&&t.attempts.used===e.attempts.used}function Z(e,n){let t=g(e.sessionId),i=f(e).find(r=>z.has(r.checkType)&&r.state==="input_required"&&r.reason!==void 0);if(i?.reason==="mobile_required")return k(t,"mobile_required");if(i?.reason!==void 0){if(i.result==="unavailable")return k(t,i.reason);let a=n.autoRetry&&(P(i)>0||Q(i,n.previous))?{sessionId:t,status:"retry",reasonCode:i.reason,attemptsRemaining:P(i)}:{sessionId:t,status:"not_verified",reason:J(i.result),reasonCode:i.reason,attemptsRemaining:P(i)};return i.retakeHint!==void 0&&(a.retakeHint=i.retakeHint),a}let o=V(e);return o===void 0&&f(e).some(r=>r.state==="review")?T(t,"review",L(e,"review")):o?.checkType==="portrait_icao"?k(t,"portrait_required"):k(t)}function L(e,n){return f(e).find(t=>t.state===n&&t.reason!==void 0)?.reason}function F(e,n,t,i,o){return e.presignCapture!==void 0?e.presignCapture(n,t,i,o):e.presign(n,t,i)}function K(e){return{engine:e?.engine,durationMs:e?.clipMs}}var ee=["video/webm","video/mp4"],O="image/jpeg",ne=2,te=1e3,ie=1e4,oe=3,re=10,se=3,ae=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),ue=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","check_not_active","step_not_on_path"]),C=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}};function de(e){let n=S(e);return y(e,"portrait_icao")?.state!=="pending"&&(n!==void 0?_(n):e.capture?.livePhoto?.oneCapture===!0)}var w=class extends Error{constructor(n){super(n),this.name="AttestationError"}};async function N(e,n,t={}){let i=e.uuid(),o=!1,r=!1,a=0,l=0;for(;;)try{return await n(e.client,i)}catch(s){if(s instanceof w){if(r)throw s;r=!0,t.onAttestationInvalid?.(),i=e.uuid();continue}if(!(s instanceof b))throw s;if(s.code==="consent_required"&&!o){o=!0,await e.ensureConsent({force:!0}),i=e.uuid();continue}if(s.code==="attestation_invalid"&&!r){r=!0,t.onAttestationInvalid?.(),i=e.uuid();continue}if(s.code==="inference_unavailable"&&l<oe){l+=1;let d=E(s.retryAfterSeconds,re,e.random??Math.random);e.onBusy?.({attempt:l,retryAfterSeconds:d/1e3}),await e.sleep(d),t.onAttestationInvalid?.(),i=e.uuid();continue}if(ae.has(s.code)&&a<ne){a+=1;let d=s.retryAfterSeconds!==void 0?s.retryAfterSeconds*1e3:void 0;await e.sleep(d!==void 0?Math.min(d,ie):te);continue}throw s}}var ce=new Set(["passed","review","processing","skipped"]);async function Me(e){let{artifacts:n}=e,t=n.clip,i=H(n.clipMime??"");if(n.degraded==="NO_RECORDER"||t===void 0||!ee.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let o=le(e,n.keyframe),r=fe(e,t,i,o),a=pe(e,o),l=!1,s=new Set,d=!0,m=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let u=e.getView();if(I(u))return{kind:"settled"};let h=V(u),M=h?.checkType,v=M==="liveness"&&!l?"liveness":M==="face_match"&&!s.has(h?.id)&&s.size<2&&d?"face_match":null;if(v===null)return{kind:"settled"};if(v==="liveness"&&n.captureChannel==="desktop")return{kind:"unavailable",reason:"mobile_required"};try{if(v==="liveness"){l=!0;let c=await r();if(e.isCancelled())return{kind:"cancelled"};A(u,c)&&s.add(S(c)?.id);for(let D of x(u,c))s.add(D);await e.applySubmit(c,"liveness");let p=y(e.getView(),"liveness")?.state;d=p===void 0||ce.has(p)}else{s.add(h?.id);let c=await a();if(e.isCancelled())return{kind:"cancelled"};for(let p of x(u,c))s.add(p);await e.applySubmit(c,"face_match")}}catch(c){if(e.isCancelled()||c instanceof C)return{kind:"cancelled"};let p=ye(c);if(p.kind!=="resync"||m>=se)return p;m+=1,await e.refreshView()}}}function le(e,n){let t=null,i=null,o=()=>t!==null?Promise.resolve(t):(i??(i=(async()=>{let r=await F(e.client,"image",O,n.size,K(e.artifacts));return await e.client.uploadToSpaces(r.uploadUrl,n,O),t=(await e.client.completeMedia(r.key)).key,e.onKeyframePromoted?.(t),t})().finally(()=>{i=null})),i);return{ensure:o,attempt:()=>o().catch(()=>null),current:()=>t}}function fe(e,n,t,i){let o=null,r,a=null,l=0;return()=>N(e,async(s,d)=>{if(o===null||r===void 0){if(e.isCancelled())throw new C;r===void 0&&!de(e.getView())&&(r=null),e.onPhase("uploading");let[m,u]=await Promise.all([o!==null?Promise.resolve(o):(async()=>{let h=await F(s,"clip",t,n.size,K(e.artifacts));return await s.uploadToSpaces(h.uploadUrl,n,t),(await s.completeMedia(h.key)).key})(),r!==void 0?Promise.resolve(r===null?null:r.imageKey):i.attempt()]);o=m,r===void 0&&(r=u===null?null:{imageKey:u})}if(a===null){let m=performance.now();try{a=await e.getAttestation()}catch(u){throw new w(u instanceof Error?u.message:String(u))}l=Math.round(performance.now()-m)}return e.onPhase("checking"),s.submitCheck("liveness",{clipKey:o,attestation:a,captureChannel:e.artifacts.captureChannel,capture:{...me(e.artifacts),attestationMs:l},...r!==null?{faceMatch:r}:{}},{idempotencyKey:d})},{onAttestationInvalid:()=>{a=null}})}function pe(e,n){return()=>N(e,async(t,i)=>{if(n.current()===null){if(e.isCancelled())throw new C;e.onPhase("uploading")}let o=await n.ensure();return e.onPhase("checking"),t.submitCheck("face_match",{imageKey:o},{idempotencyKey:i})})}function me(e){let n={width:e.width,height:e.height};for(let t of he)e[t]!==void 0&&(n[t]=e[t]);return n}var he=["engine","facingMode","mode","formFactor","clipMs","clipFrames","fps","clipRetakes","codec","cameraReadyMs","faceAcquireMs","captureMs","screenRamp","provenance"];function ye(e){if(e instanceof w)return{kind:"unavailable",reason:"attestation"};if(e instanceof b){if(e.code==="attestation_invalid")return{kind:"unavailable",reason:"attestation"};if(e.code==="inference_unavailable")return{kind:"unavailable",reason:"inference_unavailable"};if(e.code==="mobile_required")return{kind:"unavailable",reason:"mobile_required"};if(ue.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}var q=class extends Error{constructor(n,t){super(`invalid ${n} (${t})`),this.name="InvalidInputError",this.field=n,this.kind=t}},U=class extends Error{constructor(n,t){super(`invalid ${n} (${t})`),this.name="OtpInputError",this.field=n,this.kind=t}};function B(e){return e?.source==="upload"?null:e?.source==="choice"&&e.sourcePick!=="camera"?"upload_or_phone":"phone"}function Ae(e,n){if(n===void 0||!_(n)||n.requiresMobile!==!0)return null;switch(n.checkType){case"liveness":return"phone";case"face_match":{if(n.reason!==void 0)return"phone";let t=y(e,"portrait_icao");return t?.state==="passed"||t?.state==="review"?null:"phone"}case"doc_ocr":return B(e.documents);case"portrait_icao":{let t=e.portrait;return t?.pendingFix!==void 0||t?.reuse?.pending===!0?null:B(t)}default:return null}}function Se(e){let n=e?.capture,t=n?.mode;return t==="assisted"||t==="self"||t==="choice"?t:n?.cameraSwitch===!0?"assisted":"self"}function Le(e){let n=e?.capture?.pick;return Se(e)==="choice"&&(n==="self"||n==="assisted")?n:null}function Oe(e,n,t=null){return e==="choice"?n??t??"self":e}export{_e as a,ge as b,Ce as c,$ as d,f as e,P as f,j as g,ke as h,_ as i,I as j,V as k,y as l,g as m,k as n,Re as o,Ae as p,Se as q,Le as r,Oe as s,F as t,ee as u,ne as v,te as w,oe as x,re as y,w as z,N as A,Me as B,q as C,U as D};
|