@sekyro/web 0.1.0-rc.4 → 0.1.0-rc.40
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 +491 -0
- package/LICENSE +25 -16
- package/README.md +158 -62
- package/THIRD-PARTY-NOTICES.txt +154 -0
- package/dist/assets.generated-DpkbvoII.d.cts +249 -0
- package/dist/assets.generated-DpkbvoII.d.ts +249 -0
- package/dist/background-monitor-A7FKJOAG.js +1 -0
- package/dist/barcode-detect-C5IOXMKI.js +1 -0
- package/dist/camera-trait-DELAK3YN.js +1 -0
- package/dist/capture-constraints-CVqpMNGA.d.cts +48 -0
- package/dist/capture-constraints-CVqpMNGA.d.ts +48 -0
- package/dist/capture-session-doc-DFLSX6BB.js +1 -0
- package/dist/{capture-session-v3-uXJr1Wlm.d.ts → capture-session-v3-C-9FB_vX.d.cts} +232 -13
- package/dist/{capture-session-v3-DEInCOUg.d.cts → capture-session-v3-DEpGJ_fI.d.ts} +232 -13
- package/dist/challenge-frame-YBTLAQ5G.js +1 -0
- package/dist/chunk-22AW4NJD.js +1 -0
- package/dist/chunk-33KKMPJ5.js +1 -0
- package/dist/chunk-3WQJI7UL.js +1 -0
- package/dist/chunk-4NO6MQPH.js +1 -0
- package/dist/chunk-53POX7U4.js +1 -0
- package/dist/chunk-7QZWBDI5.js +1 -0
- package/dist/chunk-BD4KIQQD.js +1 -0
- package/dist/chunk-BPAGOPYL.js +1 -0
- package/dist/chunk-BRLQIJYF.js +1 -0
- package/dist/chunk-CJHMFPL6.js +1 -0
- package/dist/chunk-CPUECYAJ.js +1 -0
- package/dist/chunk-FPXL63KZ.js +1 -0
- package/dist/chunk-FSSMUAKC.js +1 -0
- package/dist/chunk-FYU7J2DC.js +1 -0
- package/dist/chunk-GFJATPUR.js +1 -0
- package/dist/chunk-GI3UFGRQ.js +1 -0
- package/dist/chunk-JLVZ35QK.js +2 -0
- package/dist/chunk-L3TNFMQK.js +1 -0
- package/dist/chunk-M3637QGB.js +1 -0
- package/dist/chunk-MQHTFHSN.js +1 -0
- package/dist/chunk-POIQGEZM.js +1 -0
- package/dist/chunk-QB62OPX5.js +1 -0
- package/dist/chunk-QZUFICG3.js +1 -0
- package/dist/chunk-RI3E7GBN.js +1 -0
- package/dist/chunk-SJ5OJ677.js +1 -0
- package/dist/chunk-SMKCBUJL.js +1 -0
- package/dist/chunk-SX7TUC3V.js +1 -0
- package/dist/chunk-TSA6GHUG.js +1 -0
- package/dist/chunk-U5TL63CG.js +1 -0
- package/dist/chunk-VSLJZ7GH.js +1 -0
- package/dist/chunk-VWGKUQ3C.js +1 -0
- package/dist/chunk-W357WDNU.js +1 -0
- package/dist/chunk-WNBEOK5Q.js +1 -0
- package/dist/chunk-Y5GRT27C.js +3 -0
- package/dist/chunk-ZVD6VHM2.js +1 -0
- package/dist/client/index.cjs +1 -357
- package/dist/client/index.d.cts +6 -37
- package/dist/client/index.d.ts +6 -37
- package/dist/client/index.js +1 -15
- package/dist/clip-inspect-DLJXVKV6.js +1 -0
- package/dist/core/index.cjs +1 -1634
- package/dist/core/index.d.cts +5 -4
- package/dist/core/index.d.ts +5 -4
- package/dist/core/index.js +1 -139
- package/dist/core/ocr/worker.bundle.js +41 -0
- package/dist/core/ocr/worker.cjs +41 -0
- package/dist/core/ocr/worker.d.cts +97 -0
- package/dist/core/ocr/worker.d.ts +97 -0
- package/dist/core/ocr/worker.js +40 -0
- package/dist/core/v3/detect-worker.cjs +1 -392
- package/dist/core/v3/detect-worker.d.cts +1 -1
- package/dist/core/v3/detect-worker.d.ts +1 -1
- package/dist/core/v3/detect-worker.js +1 -13
- package/dist/create-document-capture-4ZOSBL3Y.js +1 -0
- package/dist/create-portrait-capture-5VGYZUOK.js +1 -0
- package/dist/create-verification-B8c9xBnz.d.ts +3871 -0
- package/dist/create-verification-BadlGBh3.d.cts +3871 -0
- package/dist/{detect-worker-CKXHlXx9.d.ts → detect-worker-CHqsPJoM.d.cts} +25 -2
- package/dist/{detect-worker-CKXHlXx9.d.cts → detect-worker-CHqsPJoM.d.ts} +25 -2
- package/dist/detector-scanic-P2RTEQUV.js +1 -0
- package/dist/icao-gate-BqXxEAq6.d.cts +610 -0
- package/dist/icao-gate-C7D7Lce7.d.ts +610 -0
- package/dist/icao-gate-T3BTOKFJ.js +1 -0
- package/dist/icao-policy-Bo7TQyTd.d.ts +80 -0
- package/dist/icao-policy-CgSI4oFo.d.cts +80 -0
- package/dist/icao-tuning-4ETMF53W.js +1 -0
- package/dist/index.cjs +3 -2698
- package/dist/index.d.cts +138 -5
- package/dist/index.d.ts +138 -5
- package/dist/index.js +1 -28
- package/dist/internal/index.cjs +3 -4228
- package/dist/internal/index.d.cts +306 -371
- package/dist/internal/index.d.ts +306 -371
- package/dist/internal/index.js +1 -647
- package/dist/keyframe-rank-YAJLYJYF.js +1 -0
- package/dist/landmarker-KB7LVXAU.js +1 -0
- package/dist/mrz-band-VYHOTDHY.js +1 -0
- package/dist/plan-runner-3BLEJWHF.js +1 -0
- package/dist/popup/index.cjs +1 -76
- package/dist/popup/index.d.cts +9 -3
- package/dist/popup/index.d.ts +9 -3
- package/dist/popup/index.js +1 -11
- package/dist/print-DCYX3CZD.js +1 -0
- package/dist/scanic-ml-stub-KW7IZHUT.js +1 -0
- package/dist/segmenter-USLNBX65.js +1 -0
- package/dist/types-BAAj6TOZ.d.cts +2230 -0
- package/dist/types-BAAj6TOZ.d.ts +2230 -0
- package/dist/upload-file-EGXXM6TQ.js +1 -0
- package/package.json +30 -11
- package/sbom.cdx.json +349 -0
- package/dist/capture-constraints-BujkZcfb.d.cts +0 -21
- package/dist/capture-constraints-BujkZcfb.d.ts +0 -21
- package/dist/chunk-EWRNPKTR.js +0 -1123
- package/dist/chunk-EWRNPKTR.js.map +0 -1
- package/dist/chunk-MWNFSNMP.js +0 -52
- package/dist/chunk-MWNFSNMP.js.map +0 -1
- package/dist/chunk-NILNKLK6.js +0 -50
- package/dist/chunk-NILNKLK6.js.map +0 -1
- package/dist/chunk-NWF46H7K.js +0 -359
- package/dist/chunk-NWF46H7K.js.map +0 -1
- package/dist/chunk-TBANUT3X.js +0 -885
- package/dist/chunk-TBANUT3X.js.map +0 -1
- package/dist/chunk-WY6U7AIK.js +0 -193
- package/dist/chunk-WY6U7AIK.js.map +0 -1
- package/dist/chunk-YVFF4Q4G.js +0 -327
- package/dist/chunk-YVFF4Q4G.js.map +0 -1
- package/dist/client/index.cjs.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/v3/detect-worker.cjs.map +0 -1
- package/dist/core/v3/detect-worker.js.map +0 -1
- package/dist/create-verification-Ce1y5kJR.d.ts +0 -371
- package/dist/create-verification-Dkb2tXuY.d.cts +0 -371
- package/dist/detector-scanic-4C6IEW2K.js +0 -787
- package/dist/detector-scanic-4C6IEW2K.js.map +0 -1
- package/dist/hosted-client-DWzCRYJK.d.cts +0 -421
- package/dist/hosted-client-DWzCRYJK.d.ts +0 -421
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/internal/index.cjs.map +0 -1
- package/dist/internal/index.js.map +0 -1
- package/dist/popup/index.cjs.map +0 -1
- package/dist/popup/index.js.map +0 -1
- package/dist/scanic-ml-stub-S2OZ6HEF.js +0 -10
- package/dist/scanic-ml-stub-S2OZ6HEF.js.map +0 -1
|
@@ -1,134 +1,110 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { bf as SubmitRuntime, a9 as LivenessCaptureOptions, a8 as LivenessCaptureHandle, aX as VerificationStep, aV as VerificationResult, aM as StepSnapshot, a4 as LivePhotoGateUpdate, bg as HostedClientLike, bh as DocCatalogEntry, bi as DeviceTier, bj as LiveMrzTuning, bk as TextLockTuning, bl as OcrEngineClient, bm as DocAssistReport, bn as ReadyInfo, bo as LoadFailure, bp as OcrEngineOptions } from '../create-verification-BadlGBh3.cjs';
|
|
2
|
+
export { bq as ANALYSIS_LONG_EDGE, br as ASPECT_BANDS, bs as AttestationError, bt as BLUR_REFUSE_SHARPNESS_MAX, bu as BlurStatus, bv as CAPTURE_CANDIDATE_SPACING_MS, bw as CAPTURE_EXTRA_CANDIDATES, bx as CHALLENGE_EXECUTE_TIMEOUT_MS, by as CHALLENGE_READY_TIMEOUT_MS, bz as CLIP_MIME_ALLOWLIST, bA as CaptureEngine, bB as CaptureSessionDoc, bC as CaptureSessionDocEvents, bD as CaptureSessionDocOptions, bE as ChallengeAction, bF as ChallengeError, m as ChallengeErrorCode, bG as DOC_ANALYSIS_DEFAULTS, bH as DOC_BLACK_FRAME_LUMA, bI as DOC_BLACK_FRAME_TICKS, bJ as DOC_CADENCE_HZ, bK as DOC_CAMERA_TUNING_DEFAULTS, bL as DOC_CATALOG, bM as DOC_DETECT_WIDTH, bN as DOC_FEEDBACK_STATES, bO as DOC_FIRST_FRAME_MS, bP as DOC_GATE_V1_DEFAULTS, bQ as DOC_SHUTTER_DEFAULTS, bR as DeviceReadHint, bS as DocArtifacts, bT as DocAssist, bU as DocAssistEngine, bV as DocAssistTick, bW as DocCameraTuning, bX as DocCaptureReport, bY as DocCaptureVia, bZ as DocChecksPayload, b_ as DocEngineLike, b$ as DocFeedbackAggregator, c0 as DocFeedbackKey, c1 as DocFeedbackState, c2 as DocFormat, c3 as DocFrameAnalysis, c4 as DocFrameMeasures, c5 as DocGateQuality, c6 as DocGateThresholds, c7 as DocGateTick, c8 as DocGateTickInput, c9 as DocGateV1, ca as DocQuad, cb as DocQuadPoint, cc as DocShutterReason, cd as DocShutterTuning, ce as DocSide, cf as DocumentCaptureController, cg as DocumentCaptureInternals, ch as EMPTY_GUIDE_METRICS, ci as EncodedDocument, cj as ExecuteChallengeOptions, ck as FLIP_FILL_MIN, cl as FLIP_GAP_MS, cm as FLIP_TIMEOUT_MS, cn as FocusCaps, co as FramingStatus, cp as GUIDE_LOCK_DEFAULTS, cq as GlareStatus, cr as GrabbedFrame, cs as GuideBlocker, ct as GuideLock, cu as GuideLockTick, cv as GuideLockTuning, cw as GuideMetrics, cx as GuideRect, cy as INFERENCE_RETRY_ATTEMPTS, cz as INFERENCE_RETRY_DEFAULT_S, a0 as ISSUER_CODES, cA as LANDMARKER_MODEL, cB as LENS_STORAGE_KEY, cC as LIVE_MRZ_DEFAULTS, cD as LIVE_PHOTO_IDLE_MS, cE as LIVE_PHOTO_MAX_HZ, cF as LandmarkedFace, cG as LandmarkerLike, cH as LensSource, cI as LightingStatus, cJ as LiveMrzCapture, cK as LiveMrzState, cL as LivePhotoGate, cM as LivePhotoKit, cN as LivePhotoKitInternals, cO as LivePhotoKitOptions, cP as LivePhotoStill, cQ as LivenessCaptureInternalHandle, cR as LivenessCaptureInternals, cS as LivenessFlowDeps, cT as LivenessFlowOutcome, cU as MANUAL_SHUTTER_MS, cV as MR_DOC_CATALOG, cW as NO_REPORT_MS, cX as OpenDocCameraDeps, cY as PORTRAIT_JPEG_QUALITY, cZ as PRELOAD_BLAZE_INIT_TIMEOUT_MS, c_ as PRELOAD_BUDGET_MS, c$ as PROCESSING_POLL_DELAY_MS, d0 as PROCESSING_POLL_MAX, d1 as PortraitCaptureController, d2 as PortraitCaptureInternals, d3 as REGISTRY_RETRY_DELAY_MS, d4 as ReticleType, d5 as SAME_FACE_MAX_DROPS, d6 as ScanEvent, d7 as ScanLayout, d8 as ScanNotice, d9 as ScanPhase, da as ScanReport, db as ScanSide, dc as ScanState, dd as SubmitExecutor, de as TEXT_LOCK_DEFAULTS, df as TRANSPORT_REPLAY_ATTEMPTS, dg as TRANSPORT_REPLAY_DELAY_MS, dh as VerificationInternals, di as analyzeDocFrame, dj as analyzeGuide, dk as aspectBand, dl as aspectFits, dm as buildDeviceReadHint, dn as coverPointToVideo, dp as createDocumentCaptureInternal, dq as createFaceLandmarker, dr as createLivePhotoKit, ds as createLivenessCaptureInternal, dt as createPortraitCaptureInternal, du as createVerificationInternal, dv as docZoomFor, dw as encodeDocumentImage, dx as executeChallenge, dy as facesOf, dz as feedbackVoteOf, dA as focusOk, dB as guideQuad, dC as guideRegionInFrame, dD as initialScanState, dE as mapEngineState, dF as mapErrorKind, dG as mapGuidanceHint, dH as nextScanState, dI as observePortraitFrame, dJ as openDocCamera, dK as passportBandOf, dL as portraitMatchStep, dM as preloadedDetectorFactory, dN as quadAreaFrac, dO as quadBounds, dP as quadIou, dQ as quadTiltRatio, dR as randomUuid, dS as readStoredLens, dT as resetChallengeFrameForTests, dU as resetLivenessAssetsForTests, dV as resolveDocCameraTuning, dW as resolveDocShutterTuning, dX as resolveGuideLockTuning, dY as runLivenessFlow, dZ as runSubmission, d_ as scannerFormatFor, d$ as setPreloadLoaderForTests, e0 as settledHint, e1 as singleShotFocusAt, e2 as specularFraction, e3 as supportsFocusMode, e4 as warmDocDetector, e5 as writeStoredLens } from '../create-verification-BadlGBh3.cjs';
|
|
3
|
+
export { O as OCR_ASSET_SET } from '../assets.generated-DpkbvoII.cjs';
|
|
4
|
+
export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, d as detectFormFactor, c as detectIsMobile } from '../capture-constraints-CVqpMNGA.cjs';
|
|
5
|
+
import { aa as HostedSessionView, i as CheckType, aH as PlanStepView } from '../types-BAAj6TOZ.cjs';
|
|
6
|
+
export { bv as ICAO_FALLBACK, bp as IcaoCaptureTuning, bw as IcaoProfile, bx as ResolvedIcaoTuning, by as resolveIcaoTuning } from '../types-BAAj6TOZ.cjs';
|
|
7
|
+
export { B as BackgroundStats, h as Box, C as CLIPPED_LUMA, F as FaceGeometry, i as FaceLighting, c as HeadPose, j as ICAO_CANVAS, k as ICAO_GATE_CRITERIA, l as ICAO_SHARP_REF, I as IcaoCoachKey, d as IcaoCriterionState, m as IcaoFrameObservation, n as IcaoGate, e as IcaoGateCriterion, o as IcaoGateOptions, p as IcaoGateScores, f as IcaoGateSummary, g as IcaoGateUpdate, q as IcaoJudgedCriterion, r as IcaoMeasures, t as IcaoMouthScores, u as IcaoPixelStats, L as LumaPlane, P as Point, R as RegionStats, v as backgroundStats, w as createIcaoGate, x as eyeLineRoll, y as eyeOpenness, z as eyeSpecular, A as faceGeometry, D as faceLighting, E as faceSharpness, G as icaoPixelStats, J as icaoWindow, K as judgeIcao, N as lumaPlane, O as percentile, Q as portraitCropRegion, T as poseFromMatrix, V as regionStats, W as scoreFrame, X as windowOverflow } from '../icao-gate-BqXxEAq6.cjs';
|
|
8
|
+
import '../detect-worker-CHqsPJoM.cjs';
|
|
9
|
+
import '../capture-session-v3-C-9FB_vX.cjs';
|
|
7
10
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
/** `processing` re-reads (1+2+4+8+15 = 30 s, spec §6.5), then `stalled`. */
|
|
12
|
+
declare const PROCESSING_BACKOFF_MS: readonly number[];
|
|
13
|
+
/** Hosted parity: a resend is offered 30 s after the last send. */
|
|
14
|
+
declare const OTP_RESEND_COOLDOWN_MS = 30000;
|
|
15
|
+
type Executor = (client: HostedClientLike, idempotencyKey: string) => Promise<HostedSessionView>;
|
|
16
|
+
interface RunnerDeps {
|
|
17
|
+
runtime: SubmitRuntime;
|
|
18
|
+
currentView(): HostedSessionView | null;
|
|
19
|
+
ensureView(): Promise<HostedSessionView>;
|
|
20
|
+
refreshView(): Promise<HostedSessionView>;
|
|
21
|
+
ensureConsent(): Promise<void>;
|
|
22
|
+
liveness(options: LivenessCaptureOptions): LivenessCaptureHandle;
|
|
23
|
+
/** A liveness submission chain is in flight (do not flip the UI mid-upload). */
|
|
24
|
+
chainBusy(): boolean;
|
|
25
|
+
destroyed(): boolean;
|
|
26
|
+
sleep(ms: number): Promise<void>;
|
|
27
|
+
isMobile(): boolean;
|
|
28
|
+
now(): number;
|
|
29
|
+
emitStep(step: VerificationStep): void;
|
|
30
|
+
emitResult(result: VerificationResult): void;
|
|
31
|
+
/**
|
|
32
|
+
* The promoted face_match probe key of the last liveness submission (profile
|
|
33
|
+
* v2 §4.4 wrong-number re-entry): after the re-entered NNI passes, the
|
|
34
|
+
* `pending` face_match is resubmitted with it — no new capture. `null` when
|
|
35
|
+
* no liveness was submitted from this page (e.g. after a reload).
|
|
36
|
+
*/
|
|
37
|
+
keptFaceKey?(): string | null;
|
|
38
|
+
/** Task 4: binds the document step (selectDocument + capture). */
|
|
39
|
+
bindDocument?(snapshot: Extract<StepSnapshot, {
|
|
40
|
+
kind: "document";
|
|
41
|
+
}>, republish: () => void): VerificationStep;
|
|
42
|
+
/** SDK spec §4.9: binds the ICAO portrait step (capture + portrait_icao / face_match submissions). */
|
|
43
|
+
bindPortrait?(snapshot: Extract<StepSnapshot, {
|
|
44
|
+
kind: "portrait";
|
|
45
|
+
}>, republish: () => void): VerificationStep;
|
|
46
|
+
/** Spec 2026-11-10 §7.4: binds the proof of address step (uploads, the page camera, `poa` submissions). */
|
|
47
|
+
bindProofOfAddress?(snapshot: Extract<StepSnapshot, {
|
|
48
|
+
kind: "proof_of_address";
|
|
49
|
+
}>, republish: () => void): VerificationStep;
|
|
50
|
+
/** Commit a view an action answered (flow model 2026-10-23); absent → re-read the view. */
|
|
51
|
+
setView?(view: HostedSessionView): void;
|
|
52
|
+
/** Step 3 one capture: the ICAO coaching of the running live-photo capture. */
|
|
53
|
+
onLivePhoto?(handler: (gate: LivePhotoGateUpdate) => void): () => void;
|
|
54
|
+
/** Stops every camera of the session (a skipped capture in a simulated session). */
|
|
55
|
+
stopCameras?(): void;
|
|
56
|
+
}
|
|
57
|
+
interface StepRunner {
|
|
58
|
+
run(): Promise<VerificationStep>;
|
|
59
|
+
current(): VerificationStep | null;
|
|
60
|
+
/** Called by the verification on every view update. */
|
|
61
|
+
onView(view: HostedSessionView): void;
|
|
62
|
+
/** Called when the liveness chain becomes idle. */
|
|
63
|
+
onChainIdle(): void;
|
|
64
|
+
/** Re-derive from the current view and publish even if unchanged (local overlay changed). */
|
|
65
|
+
republish(): void;
|
|
66
|
+
/** Submit one step input (exposed for the document binding, Task 4). */
|
|
67
|
+
submit(checkType: CheckType, executor: Executor, onAccepted?: () => void): Promise<void>;
|
|
68
|
+
/** "Skip with test data" answered the liveness or the portrait on this page: a following match has no probe. */
|
|
69
|
+
faceProbeSkipped(): boolean;
|
|
25
70
|
}
|
|
71
|
+
declare function createStepRunner(deps: RunnerDeps): StepRunner;
|
|
72
|
+
|
|
73
|
+
/** At most this many ranked lenses are tried (each costs a camera reopen). */
|
|
74
|
+
declare const LENS_TRY_MAX = 3;
|
|
75
|
+
type LensKind = "main" | "virtual" | "ultra" | "tele" | "depth" | "front" | "unknown";
|
|
76
|
+
/** What a camera label says about its lens (labels are English on Android Chrome / iOS Safari). */
|
|
77
|
+
declare function lensKindOf(label: string): LensKind;
|
|
26
78
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
79
|
+
* Back cameras best-first: main wide lenses (lowest Android index first), then
|
|
80
|
+
* iOS virtual multi-lens devices; ultra-wide, telephoto, depth and front lenses
|
|
81
|
+
* are dropped. Empty when nothing is identifiable (keep the browser's pick).
|
|
30
82
|
*/
|
|
31
|
-
declare
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
declare function aspectBand(format: DocFormat): {
|
|
37
|
-
center: number;
|
|
38
|
-
tolerance: number;
|
|
39
|
-
};
|
|
40
|
-
/** The MR docTypes facet (findings §4). Order = the hosted picker's display order. */
|
|
41
|
-
declare const MR_DOC_CATALOG: readonly DocCatalogEntry[];
|
|
83
|
+
declare function rankBackCameras(devices: ReadonlyArray<{
|
|
84
|
+
deviceId: string;
|
|
85
|
+
label: string;
|
|
86
|
+
kind?: string;
|
|
87
|
+
}>): string[];
|
|
42
88
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
x: number;
|
|
49
|
-
y: number;
|
|
50
|
-
}
|
|
51
|
-
/** Detected document quad, image-space pixels (scanic CornerPoints shape). */
|
|
52
|
-
interface DocQuad {
|
|
53
|
-
topLeft: DocQuadPoint;
|
|
54
|
-
topRight: DocQuadPoint;
|
|
55
|
-
bottomRight: DocQuadPoint;
|
|
56
|
-
bottomLeft: DocQuadPoint;
|
|
57
|
-
}
|
|
58
|
-
interface DocGateThresholds {
|
|
59
|
-
/** Quad area / frame area below which the doc is too far. */
|
|
60
|
-
MIN_AREA_FRAC: number;
|
|
61
|
-
/** A corner this close to (or past) a frame edge counts as clipped. */
|
|
62
|
-
EDGE_CLIP_MARGIN_PX: number;
|
|
63
|
-
/** Consecutive stable plausible+quality ticks required to fire. */
|
|
64
|
-
STABLE_TICKS: number;
|
|
65
|
-
/** Quad-bbox IoU with the previous tick at/above which the streak holds. */
|
|
66
|
-
IOU_STABLE_MIN: number;
|
|
67
|
-
/** Integrator slopes, per second — mirrors FaceGateV3's gentle drain. */
|
|
68
|
-
RISE_PER_S: number;
|
|
69
|
-
FALL_PER_S: number;
|
|
70
|
-
/** Quality guidance trigger levels (same semantics as the face gate). */
|
|
71
|
-
GUIDE_EXPOSURE: number;
|
|
72
|
-
GUIDE_SHARPNESS: number;
|
|
73
|
-
/** ID-3 (MRZ-band mode): band width / frame width floor. */
|
|
74
|
-
ID3_BAND_MIN_WIDTH_FRAC: number;
|
|
75
|
-
/** ID-3 (MRZ-band mode): band aspect (w/h) sanity bounds. */
|
|
76
|
-
ID3_BAND_ASPECT_MIN: number;
|
|
77
|
-
ID3_BAND_ASPECT_MAX: number;
|
|
78
|
-
}
|
|
79
|
-
/** Frozen defaults (plan Task 34 — do not retune without a golden update). */
|
|
80
|
-
declare const DOC_GATE_V1_DEFAULTS: Readonly<DocGateThresholds>;
|
|
81
|
-
interface DocGateQuality {
|
|
82
|
-
/** frame-quality.sharpness on the quad crop. */
|
|
83
|
-
sharpness: number;
|
|
84
|
-
/** frame-quality.exposure on the quad crop. */
|
|
85
|
-
exposure: number;
|
|
86
|
-
/** Mean crop luma — picks more_light vs too_bright. */
|
|
87
|
-
meanLuma: number;
|
|
88
|
-
}
|
|
89
|
-
interface DocGateTickInput {
|
|
90
|
-
timestampMs: number;
|
|
91
|
-
quad: DocQuad | null;
|
|
92
|
-
quality: DocGateQuality;
|
|
93
|
-
frameWidth: number;
|
|
94
|
-
frameHeight: number;
|
|
95
|
-
}
|
|
96
|
-
/** Per-tick output — the scanner chrome contract. */
|
|
97
|
-
interface DocGateTick {
|
|
98
|
-
at: number;
|
|
99
|
-
quad: DocQuad | null;
|
|
100
|
-
/** Geometry passed: present × big enough × in frame × right shape. */
|
|
101
|
-
plausible: boolean;
|
|
102
|
-
/** Integrated progress 0..1 (the overlay ring). */
|
|
103
|
-
p: number;
|
|
104
|
-
/** dcv1.* message key (host translates; never prose). */
|
|
105
|
-
guidanceKey: string;
|
|
106
|
-
/** Fire signal: plausible × quality × STABLE_TICKS consecutive high-IoU ticks. */
|
|
107
|
-
ready: boolean;
|
|
108
|
-
/** Current stability streak length (diagnostics/telemetry). */
|
|
109
|
-
stableTicks: number;
|
|
110
|
-
}
|
|
111
|
-
/** Shoelace area of the quad as a fraction of the frame area. */
|
|
112
|
-
declare function quadAreaFrac(quad: DocQuad, frameWidth: number, frameHeight: number): number;
|
|
113
|
-
/** IoU of the two quads' axis-aligned bounding boxes (stability metric). */
|
|
114
|
-
declare function quadIou(a: DocQuad, b: DocQuad): number;
|
|
115
|
-
/** Axis-aligned bounds (width/height) of a quad — the ID-3 band-mode geometry. */
|
|
116
|
-
declare function quadBounds(quad: DocQuad): {
|
|
117
|
-
width: number;
|
|
118
|
-
height: number;
|
|
119
|
-
};
|
|
120
|
-
declare class DocGateV1 {
|
|
121
|
-
private readonly t;
|
|
122
|
-
private readonly format;
|
|
123
|
-
private p;
|
|
124
|
-
private lastTickAt;
|
|
125
|
-
private lastQuad;
|
|
126
|
-
private streak;
|
|
127
|
-
constructor(format: DocFormat, overrides?: Partial<DocGateThresholds>);
|
|
128
|
-
reset(): void;
|
|
129
|
-
tick(input: DocGateTickInput): DocGateTick;
|
|
130
|
-
private edgeClipped;
|
|
89
|
+
type DocumentTypeId = DocCatalogEntry["docType"];
|
|
90
|
+
/** Same shape as the hosted view's `acceptedDocuments`. */
|
|
91
|
+
interface AcceptedDocumentsLike {
|
|
92
|
+
default: "*" | readonly DocumentTypeId[];
|
|
93
|
+
byIssuer?: Readonly<Record<string, readonly DocumentTypeId[]>>;
|
|
131
94
|
}
|
|
95
|
+
/** Picker order. */
|
|
96
|
+
declare const DOCUMENT_TYPE_ORDER: readonly DocumentTypeId[];
|
|
97
|
+
/** Types accepted for documents of `issuer` (ISO alpha-2), in picker order. */
|
|
98
|
+
declare function acceptedTypesFor(accepted: AcceptedDocumentsLike, issuer: string): DocumentTypeId[];
|
|
99
|
+
/** Issuers with at least one accepted type, sorted by code (the UI re-sorts by name). */
|
|
100
|
+
declare function acceptedIssuers(accepted: AcceptedDocumentsLike, codes?: readonly string[]): string[];
|
|
101
|
+
/** `acceptedDocuments`, or — from a server that predates it — MR with the legacy list. */
|
|
102
|
+
declare function resolveAcceptedDocuments(view: {
|
|
103
|
+
acceptedDocuments?: AcceptedDocumentsLike | undefined;
|
|
104
|
+
acceptedDocumentTypes?: readonly DocumentTypeId[] | undefined;
|
|
105
|
+
}): AcceptedDocumentsLike;
|
|
106
|
+
/** 🇲🇷-style flag from an alpha-2 code (regional indicator symbols). */
|
|
107
|
+
declare function flagOf(iso2: string): string;
|
|
132
108
|
|
|
133
109
|
interface MrzBand {
|
|
134
110
|
x: number;
|
|
@@ -162,270 +138,229 @@ declare const MRZ_BAND_DEFAULTS: Readonly<MrzBandThresholds>;
|
|
|
162
138
|
*/
|
|
163
139
|
declare function detectMrzBand(frame: ImageData, overrides?: Partial<MrzBandThresholds>): MrzBand | null;
|
|
164
140
|
|
|
165
|
-
type
|
|
166
|
-
type
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
framing: FramingStatus;
|
|
172
|
-
lighting: LightingStatus;
|
|
173
|
-
blur: BlurStatus;
|
|
174
|
-
glare: GlareStatus;
|
|
175
|
-
/** All-clear: every axis ok — the gate's integrator/stability input. */
|
|
176
|
-
acceptable: boolean;
|
|
177
|
-
}
|
|
178
|
-
interface DocFrameMeasures {
|
|
179
|
-
/** frame-quality sharpness on the doc-region crop (0..1). */
|
|
180
|
-
sharpness: number;
|
|
181
|
-
/** frame-quality exposure on the doc-region crop (0..1). */
|
|
182
|
-
exposure: number;
|
|
183
|
-
/** Mean crop luma (0..255) — picks too_dark vs too_bright. */
|
|
184
|
-
meanLuma: number;
|
|
185
|
-
/** Fraction of crop pixels at/above the specular ceiling (0..1). */
|
|
186
|
-
specularFraction: number;
|
|
187
|
-
}
|
|
188
|
-
/** Analysis thresholds beyond the gate's — frozen defaults (round 4). */
|
|
189
|
-
declare const DOC_ANALYSIS_DEFAULTS: Readonly<{
|
|
190
|
-
/** Doc area fraction above which the camera is too close (capture would crop). */
|
|
191
|
-
MAX_AREA_FRAC: 0.92;
|
|
192
|
-
/** Opposite-side length ratio beyond which the view is too oblique. */
|
|
193
|
-
TILT_MAX_SIDE_RATIO: 1.3;
|
|
194
|
-
/** Specular-pixel fraction at/above which the frame reads as glare. */
|
|
195
|
-
GLARE_MAX_SPECULAR_FRAC: 0.025;
|
|
196
|
-
}>;
|
|
197
|
-
/** Fraction of crop pixels with luma ≥ 252 — cheap specular-highlight measure. */
|
|
198
|
-
declare function specularFraction(crop: ImageData): number;
|
|
199
|
-
/** Opposite-side length ratio of the quad (1 = fronto-parallel). */
|
|
200
|
-
declare function quadTiltRatio(quad: DocQuad): number;
|
|
201
|
-
/**
|
|
202
|
-
* Judge one frame. `detectionMode` mirrors the gate: ID-1 quads carry
|
|
203
|
-
* area/aspect/tilt semantics; ID-3 MRZ bands carry width-fraction semantics
|
|
204
|
-
* (band rects are axis-aligned, so tilt/aspect checks are band-specific).
|
|
205
|
-
*/
|
|
206
|
-
declare function analyzeDocFrame(input: {
|
|
207
|
-
format: DocFormat;
|
|
208
|
-
quad: DocQuad | null;
|
|
209
|
-
frameWidth: number;
|
|
210
|
-
frameHeight: number;
|
|
211
|
-
measures: DocFrameMeasures;
|
|
212
|
-
thresholds?: Partial<DocGateThresholds>;
|
|
213
|
-
}): DocFrameAnalysis;
|
|
214
|
-
|
|
215
|
-
/** Feedback vocabulary (dcv2.* message keys on the hosted side). */
|
|
216
|
-
type DocFeedbackKey = "sensing" | "too_far" | "too_close" | "edge_clipped" | "wrong_shape" | "tilted" | "too_dark" | "too_bright" | "blurry" | "glare" | "hold_still" | "processing" | "side_captured" | "captured";
|
|
217
|
-
/** Reticle rendering mode per feedback state (the stage maps to visuals). */
|
|
218
|
-
type ReticleType = "searching" | "coaching" | "locking" | "processing" | "flip" | "done";
|
|
219
|
-
interface DocFeedbackState {
|
|
220
|
-
key: DocFeedbackKey;
|
|
221
|
-
reticle: ReticleType;
|
|
222
|
-
/** The state holds the UI at least this long (ms) before a switch. */
|
|
223
|
-
minDurationMs: number;
|
|
224
|
-
}
|
|
225
|
-
declare const DOC_FEEDBACK_STATES: Readonly<Record<DocFeedbackKey, DocFeedbackState>>;
|
|
226
|
-
/** Frame analysis → the feedback vote it casts (worst axis speaks). */
|
|
227
|
-
declare function feedbackVoteOf(analysis: DocFrameAnalysis): DocFeedbackKey;
|
|
228
|
-
/** Sliding vote window + exponential decay + per-state minimum hold. */
|
|
229
|
-
declare class DocFeedbackAggregator {
|
|
230
|
-
private readonly windowMs;
|
|
231
|
-
/** Per-second decay factor — recent frames outvote stale ones. */
|
|
232
|
-
private readonly decayPerSecond;
|
|
233
|
-
private votes;
|
|
234
|
-
private current;
|
|
235
|
-
private currentSinceMs;
|
|
236
|
-
constructor(windowMs?: number,
|
|
237
|
-
/** Per-second decay factor — recent frames outvote stale ones. */
|
|
238
|
-
decayPerSecond?: number);
|
|
239
|
-
reset(): void;
|
|
240
|
-
/** Force a terminal/choreography state (capture fired, side flip, upload). */
|
|
241
|
-
force(key: Extract<DocFeedbackKey, "processing" | "side_captured" | "captured">, nowMs: number): DocFeedbackState;
|
|
242
|
-
/** Cast this frame's vote and return the (possibly held) winning state. */
|
|
243
|
-
tick(vote: DocFeedbackKey, nowMs: number): DocFeedbackState;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Pre-fetch + cache the scanic chunk (call when the scan surface MOUNTS, before
|
|
248
|
-
* the camera is even granted) so the first detect tick pays no chunk-fetch
|
|
249
|
-
* latency. Fire-and-forget; failures fall back to the lazy path.
|
|
250
|
-
*/
|
|
251
|
-
declare function warmDocDetector(): void;
|
|
252
|
-
/** Doc detect cadence per device class — scanic @480px is ~3–8× a face tick,
|
|
253
|
-
* so the doc loop paces slower than the face profiles (findings §1: 2–5 Hz). */
|
|
254
|
-
declare const DOC_CADENCE_HZ: Readonly<Record<DeviceClass, number>>;
|
|
255
|
-
interface DocChecksPayload {
|
|
256
|
-
engine: "docv1";
|
|
257
|
-
/** Gate integrator 0..1 — the overlay ring. */
|
|
258
|
-
p: number;
|
|
259
|
-
plausible: boolean;
|
|
260
|
-
stableTicks: number;
|
|
261
|
-
quad: DocQuad | null;
|
|
262
|
-
/** Detect-frame size the quad coordinates live in (overlay scaling). */
|
|
263
|
-
frameWidth: number;
|
|
264
|
-
frameHeight: number;
|
|
265
|
-
/** Capture-v2 per-frame status vector (framing/lighting/blur/glare). */
|
|
266
|
-
analysis: DocFrameAnalysis;
|
|
267
|
-
}
|
|
268
|
-
/** Artifacts: `keyframe` = the full-res still of the framed side (JPEG). */
|
|
269
|
-
type DocArtifacts = CaptureArtifacts & {
|
|
270
|
-
side?: DocSide;
|
|
141
|
+
type CapabilityFailure = "simd" | "worker" | "bitmap";
|
|
142
|
+
type Capability = {
|
|
143
|
+
ok: true;
|
|
144
|
+
} | {
|
|
145
|
+
ok: false;
|
|
146
|
+
reason: CapabilityFailure;
|
|
271
147
|
};
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
148
|
+
type Probe = {
|
|
149
|
+
WebAssembly?: {
|
|
150
|
+
validate?: (b: BufferSource) => boolean;
|
|
275
151
|
};
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
152
|
+
Worker?: unknown;
|
|
153
|
+
createImageBitmap?: unknown;
|
|
154
|
+
navigator?: {
|
|
155
|
+
connection?: {
|
|
156
|
+
saveData?: boolean;
|
|
157
|
+
effectiveType?: string;
|
|
158
|
+
};
|
|
280
159
|
};
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
160
|
+
};
|
|
161
|
+
declare function probeCapabilities(g?: Probe): Capability;
|
|
162
|
+
|
|
163
|
+
/** This build's engine (packages/sekyro-ocr-wasm wasm-engine.lock.json `engine`). */
|
|
164
|
+
declare const WEB_OCR_ENGINE = "sekyro-ocr-1";
|
|
165
|
+
interface WebOcrPlan {
|
|
166
|
+
/** Create the engine for this session (some OCR path is live). */
|
|
167
|
+
enabled: boolean;
|
|
168
|
+
liveMrz: (LiveMrzTuning & {
|
|
169
|
+
hint: boolean;
|
|
170
|
+
stillConfirm: boolean;
|
|
171
|
+
}) | null;
|
|
172
|
+
textLock: TextLockTuning | null;
|
|
173
|
+
/** The A/B arm per block (`null`: the block is absent or disabled — no report). */
|
|
174
|
+
liveMrzArm: "live" | "control" | null;
|
|
175
|
+
frontLockArm: "live" | "control" | null;
|
|
176
|
+
load: {
|
|
177
|
+
detectorLimit: number;
|
|
178
|
+
loadTimeoutMs: number;
|
|
179
|
+
maxDownloadMs: number;
|
|
288
180
|
};
|
|
181
|
+
reportSampleRate: number;
|
|
289
182
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* BEST-FRAME capture window (capture-v2): the first ready tick captures a
|
|
344
|
-
* candidate immediately, then up to CAPTURE_EXTRA_CANDIDATES more stills are
|
|
345
|
-
* taken at CAPTURE_CANDIDATE_SPACING_MS while the user holds — each scored
|
|
346
|
-
* by the live detect-tick sharpness at its capture moment — and the SHARPEST
|
|
347
|
-
* wins. Beats first-acceptable-frame capture without decoding stills.
|
|
348
|
-
*/
|
|
349
|
-
private fire;
|
|
183
|
+
/** `capture.document` → the plan. `mode: "off"` (the embedded option) turns every OCR path off. */
|
|
184
|
+
declare function resolveWebOcrPlan(document: unknown, o?: {
|
|
185
|
+
mode?: "auto" | "off";
|
|
186
|
+
engine?: string;
|
|
187
|
+
}): WebOcrPlan;
|
|
188
|
+
type WebOcrStart = {
|
|
189
|
+
ok: true;
|
|
190
|
+
engine: OcrEngineClient;
|
|
191
|
+
} | {
|
|
192
|
+
ok: false;
|
|
193
|
+
reason: "unsupported" | "off";
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Create the engine when the plan, the device (SIMD, workers, bitmaps) and the network allow; else the reason
|
|
197
|
+
* (`off`: nothing enabled for this session; `unsupported`: the device or a slow / Save-Data connection). The device
|
|
198
|
+
* RAM no longer gates (D3): with the warm-up benchmark it picks the tier, and the low tier keeps the live MRZ read.
|
|
199
|
+
* `liveMrz.minDeviceMemoryGb` from older servers is ignored.
|
|
200
|
+
*/
|
|
201
|
+
declare function startWebOcr(plan: WebOcrPlan, o: Pick<OcrEngineOptions, "baseUrl" | "salt" | "workerUrl" | "createWorker" | "page" | "deviceMemoryGb"> & {
|
|
202
|
+
probe?: typeof probeCapabilities;
|
|
203
|
+
slow?: () => boolean;
|
|
204
|
+
}): WebOcrStart;
|
|
205
|
+
type BrowserFamily = "chrome" | "safari" | "samsung" | "firefox" | "other";
|
|
206
|
+
/** A fixed browser family (spec §10): from UA brands / tokens, never the UA string itself. */
|
|
207
|
+
declare function browserFamily(ua?: string): BrowserFamily;
|
|
208
|
+
/** The `live_mrz` wire report (identity-backend capture-report.schema.ts LiveMrzReportSchema). Enums and integers only. */
|
|
209
|
+
interface LiveMrzWireReport {
|
|
210
|
+
kind: "live_mrz";
|
|
211
|
+
platform: "web";
|
|
212
|
+
engine: string;
|
|
213
|
+
arm: "live" | "control";
|
|
214
|
+
capture: "recto" | "verso" | "single";
|
|
215
|
+
outcome: "valid" | "locked" | "timeout" | "slow" | "unsupported" | "download" | "integrity" | "error" | "off";
|
|
216
|
+
reads: number;
|
|
217
|
+
format?: "TD1" | "TD2" | "TD3";
|
|
218
|
+
framesToValid?: number;
|
|
219
|
+
msToValid?: number;
|
|
220
|
+
framesToLock?: number;
|
|
221
|
+
msToLock?: number;
|
|
222
|
+
msToCapture?: number;
|
|
223
|
+
warmupMs?: number;
|
|
224
|
+
readP50Ms?: number;
|
|
225
|
+
readP90Ms?: number;
|
|
226
|
+
downloadMs?: number;
|
|
227
|
+
cached?: boolean;
|
|
228
|
+
stillConfirmed?: boolean;
|
|
229
|
+
typeMismatch?: boolean;
|
|
230
|
+
deviceClass?: "fast" | "mid" | "slow";
|
|
231
|
+
/** The device tier (tier.ts) and the warm-up micro-benchmark it came from (ms). */
|
|
232
|
+
tier?: DeviceTier;
|
|
233
|
+
benchMs?: number;
|
|
234
|
+
browser: BrowserFamily;
|
|
350
235
|
}
|
|
351
|
-
/** Best-frame window: 2 extra candidates, 260ms apart, ≥8% sharper to replace. */
|
|
352
|
-
declare const CAPTURE_EXTRA_CANDIDATES = 2;
|
|
353
|
-
declare const CAPTURE_CANDIDATE_SPACING_MS = 260;
|
|
354
|
-
|
|
355
236
|
/**
|
|
356
|
-
*
|
|
357
|
-
* (
|
|
358
|
-
* source of truth; identity-hosted/lib/reason-copy.ts mirrors the same rows).
|
|
237
|
+
* One face's report: from the assist's report when it ran, else the engine's load outcome (`unsupported`, `download`,
|
|
238
|
+
* `integrity`, `error`/`timeout` → error) or `off` (the control arm). `arm` = the block's arm for this face.
|
|
359
239
|
*/
|
|
360
|
-
declare
|
|
240
|
+
declare function liveMrzWireReport(i: {
|
|
241
|
+
arm: "live" | "control";
|
|
242
|
+
capture: "recto" | "verso" | "single";
|
|
243
|
+
assist?: DocAssistReport | null;
|
|
244
|
+
load?: ReadyInfo | LoadFailure | "off" | null;
|
|
245
|
+
msToCapture?: number;
|
|
246
|
+
stillConfirmed?: boolean;
|
|
247
|
+
typeMismatch?: boolean;
|
|
248
|
+
browser?: BrowserFamily;
|
|
249
|
+
engine?: string;
|
|
250
|
+
}): LiveMrzWireReport;
|
|
251
|
+
/** A valid live read whose format contradicts the picked document (spec D5 state 4): TD3 on a card, TD1/TD2 on a passport. */
|
|
252
|
+
declare function formatMismatch(format: "TD1" | "TD2" | "TD3" | undefined, picked: "passport" | "card"): boolean;
|
|
253
|
+
|
|
361
254
|
/** A check the browser may still submit. */
|
|
362
|
-
declare function isExecutable(step:
|
|
255
|
+
declare function isExecutable(step: Pick<PlanStepView, "state"> | undefined): boolean;
|
|
363
256
|
/** The session accepts no further submissions. */
|
|
364
257
|
declare function isTerminalView(view: Pick<HostedSessionView, "status">): boolean;
|
|
365
|
-
/**
|
|
366
|
-
declare function frontierStep(view: HostedSessionView):
|
|
367
|
-
|
|
258
|
+
/** The step `plan.current` names while it can still be submitted (the backend's frontier). */
|
|
259
|
+
declare function frontierStep(view: HostedSessionView): PlanStepView | undefined;
|
|
260
|
+
/** The first plan step of a check type (a step-up lists two `face_match` nodes: see {@link matchAfterLiveness}). */
|
|
261
|
+
declare function stepOf(view: HostedSessionView, checkType: CheckType): PlanStepView | undefined;
|
|
368
262
|
/**
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
263
|
+
* Map the session view to the public result (session outcome model §5.1):
|
|
264
|
+
* - `verified` → `verified`; `review_pending` → `review` (the reviewed step's code);
|
|
265
|
+
* - `not_verified` → `not_verified` with the view's `reason` and `reasonCode` (and
|
|
266
|
+
* `retryAfter` on a device cooldown); a status this version does not know is
|
|
267
|
+
* `not_verified` without a reason, never `review`;
|
|
268
|
+
* - in flight, on the last step's `result`: a biometric step parked at `input_required`
|
|
269
|
+
* with tries left → `retry` when `autoRetry` is on (a step whose result is
|
|
270
|
+
* `unavailable` → `unavailable`: the service could not run it, `mobile_required` →
|
|
271
|
+
* `unavailable`: only a phone can capture it); with `autoRetry` off or no try left the
|
|
272
|
+
* capture was refused → `not_verified` with the reason its result gives; a step in
|
|
273
|
+
* `review` with nothing executable left → `review`; otherwise `unavailable` (a
|
|
274
|
+
* non-biometric frontier the SDK cannot drive, or still processing).
|
|
374
275
|
*/
|
|
375
|
-
declare function
|
|
276
|
+
declare function mapSessionResult(view: HostedSessionView, opts: ResultOptions): VerificationResult;
|
|
376
277
|
/**
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* - in flight: a biometric step parked at `input_required` with a retryable
|
|
382
|
-
* reason → `retry` when `autoRetry` and attempts remain, else `rejected`
|
|
383
|
-
* (the partner opted out of retries — this capture was refused); a step in
|
|
384
|
-
* `review` with nothing executable left → `review`; otherwise `unavailable`
|
|
385
|
-
* (a non-biometric frontier the SDK cannot drive, or still processing).
|
|
278
|
+
* Options of {@link mapSessionResult}: `autoRetry` (the host's opt-out of re-captures) and
|
|
279
|
+
* `previous`, the view the capture was submitted against (when the caller has it): a parked
|
|
280
|
+
* step whose `attempts.used` did not grow was VOIDED by the backend (a capture retake that
|
|
281
|
+
* costs nothing), so it is a retake whatever its reason.
|
|
386
282
|
*/
|
|
387
|
-
|
|
283
|
+
interface ResultOptions {
|
|
388
284
|
autoRetry: boolean;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
declare const TURNSTILE_SCRIPT_SRC = "https://challenges.cloudflare.com/turnstile/v0/api.js";
|
|
392
|
-
/** Bound on a single execute round-trip (challenge fetch + solve). */
|
|
393
|
-
declare const TURNSTILE_EXECUTE_TIMEOUT_MS = 30000;
|
|
394
|
-
interface TurnstileRenderParams {
|
|
395
|
-
sitekey: string;
|
|
396
|
-
callback: (token: string) => void;
|
|
397
|
-
"error-callback"?: (code?: string) => void;
|
|
398
|
-
execution?: "render" | "execute";
|
|
399
|
-
appearance?: "always" | "execute" | "interaction-only";
|
|
400
|
-
}
|
|
401
|
-
/** The subset of the Turnstile JS API this module uses. */
|
|
402
|
-
interface TurnstileApi {
|
|
403
|
-
render(container: HTMLElement, params: TurnstileRenderParams): string | undefined;
|
|
404
|
-
execute(widgetId: string): void;
|
|
405
|
-
remove(widgetId: string): void;
|
|
285
|
+
previous?: HostedSessionView;
|
|
406
286
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
*
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Face of a decoded still: an MRZ band means the verso. With `cardOnly` (the still is the card itself) the band must
|
|
290
|
+
* sit in its lower half, where a card's MRZ is: the line of print across a recto's top (the issuing state) is not one.
|
|
291
|
+
*/
|
|
292
|
+
declare function classifyCardSideWith(detect: typeof detectMrzBand, still: ImageData, cardOnly?: boolean): "recto" | "verso";
|
|
293
|
+
/** {@link classifyCardSideWith} with the MRZ-band detector loaded on demand. */
|
|
294
|
+
declare function classifyCardSide(still: ImageData, cardOnly?: boolean): Promise<"recto" | "verso">;
|
|
295
|
+
/** Downscale a captured JPEG to a 480 px-wide ImageData for the classifier. */
|
|
296
|
+
declare function stillToImageData(blob: Blob, width?: number): Promise<ImageData | null>;
|
|
297
|
+
|
|
298
|
+
/** Long side the measure runs at (Mattel: about what the recognizer sees of a card). */
|
|
299
|
+
declare const SHARPNESS_LONG_EDGE = 1000;
|
|
300
|
+
/** Inverse-edge-width sharpness of an RGBA image; `-1` for an unusable one (< 16 px). */
|
|
301
|
+
declare function photoSharpness(image: {
|
|
302
|
+
data: ArrayLike<number>;
|
|
303
|
+
width: number;
|
|
304
|
+
height: number;
|
|
305
|
+
}): number;
|
|
306
|
+
/** A rectangle of the full-resolution still, in its pixels. */
|
|
307
|
+
interface StillRegion {
|
|
308
|
+
x: number;
|
|
309
|
+
y: number;
|
|
310
|
+
width: number;
|
|
311
|
+
height: number;
|
|
422
312
|
}
|
|
313
|
+
/** Padding around the card's bounding box, as a fraction of its size per side. */
|
|
314
|
+
declare const REGION_PAD = 0.06;
|
|
315
|
+
/**
|
|
316
|
+
* The card region of the still (Mattel measures the guide region, not the
|
|
317
|
+
* whole photo): the bounding box of the last gate quad — in detect-frame
|
|
318
|
+
* coordinates — scaled to the still, padded by {@link REGION_PAD} and clamped.
|
|
319
|
+
* `null` when there is no usable quad (then the whole still is measured).
|
|
320
|
+
*/
|
|
321
|
+
declare function stillRegionOf(quad: {
|
|
322
|
+
topLeft: {
|
|
323
|
+
x: number;
|
|
324
|
+
y: number;
|
|
325
|
+
};
|
|
326
|
+
topRight: {
|
|
327
|
+
x: number;
|
|
328
|
+
y: number;
|
|
329
|
+
};
|
|
330
|
+
bottomRight: {
|
|
331
|
+
x: number;
|
|
332
|
+
y: number;
|
|
333
|
+
};
|
|
334
|
+
bottomLeft: {
|
|
335
|
+
x: number;
|
|
336
|
+
y: number;
|
|
337
|
+
};
|
|
338
|
+
} | null, frame: {
|
|
339
|
+
width: number;
|
|
340
|
+
height: number;
|
|
341
|
+
}, still: {
|
|
342
|
+
width: number;
|
|
343
|
+
height: number;
|
|
344
|
+
}, pad?: number): StillRegion | null;
|
|
345
|
+
type RawImage = {
|
|
346
|
+
data: ArrayLike<number>;
|
|
347
|
+
width: number;
|
|
348
|
+
height: number;
|
|
349
|
+
};
|
|
350
|
+
/** Crop `region` out of an RGBA image (pure; the canvas path does the same with drawImage). */
|
|
351
|
+
declare function cropImage(image: RawImage, region: StillRegion): {
|
|
352
|
+
data: Uint8ClampedArray;
|
|
353
|
+
width: number;
|
|
354
|
+
height: number;
|
|
355
|
+
};
|
|
356
|
+
/** Area-average downscale so the long side is at most `longEdge` (pure; mirrors cv INTER_AREA). */
|
|
357
|
+
declare function resizeLongEdge(image: RawImage, longEdge?: number): RawImage;
|
|
358
|
+
/** The blur-gate measure of a still: its card region (or the whole still), scaled to ≤ 1000 px. */
|
|
359
|
+
declare function measureRegionSharpness(image: RawImage, region: StillRegion | null): number;
|
|
423
360
|
/**
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
* — the verification maps a failure to `result {status:'unavailable',
|
|
427
|
-
* reason:'attestation'}` after one retry.
|
|
361
|
+
* Browser path of {@link measureRegionSharpness} on an already decoded still:
|
|
362
|
+
* one drawImage crops and scales the region; the canvas is released after.
|
|
428
363
|
*/
|
|
429
|
-
declare function
|
|
364
|
+
declare function measureBitmapSharpness(bitmap: ImageBitmap, region: StillRegion | null): number;
|
|
430
365
|
|
|
431
|
-
export {
|
|
366
|
+
export { type AcceptedDocumentsLike, type BrowserFamily, DOCUMENT_TYPE_ORDER, DocAssistReport, DocCatalogEntry, type DocumentTypeId, HostedClientLike, LENS_TRY_MAX, type LensKind, LiveMrzTuning, type LiveMrzWireReport, LoadFailure, MRZ_BAND_DEFAULTS, type MrzBand, type MrzBandThresholds, OTP_RESEND_COOLDOWN_MS, OcrEngineClient, PROCESSING_BACKOFF_MS, REGION_PAD, ReadyInfo, type RunnerDeps, SHARPNESS_LONG_EDGE, type StepRunner, type StillRegion, SubmitRuntime, TextLockTuning, WEB_OCR_ENGINE, type WebOcrPlan, type WebOcrStart, acceptedIssuers, acceptedTypesFor, browserFamily, classifyCardSide, classifyCardSideWith, createStepRunner, cropImage, detectMrzBand, flagOf, formatMismatch, frontierStep, isExecutable, isTerminalView, lensKindOf, liveMrzWireReport, mapSessionResult, measureBitmapSharpness, measureRegionSharpness, photoSharpness, rankBackCameras, resizeLongEdge, resolveAcceptedDocuments, resolveWebOcrPlan, startWebOcr, stepOf, stillRegionOf, stillToImageData };
|