@baas-id/react 0.2.2

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.
Files changed (129) hide show
  1. package/LICENSE.md +176 -0
  2. package/README.md +171 -0
  3. package/THIRD_PARTY_NOTICES.md +44 -0
  4. package/dist/esm/baas-id-react.css +1 -0
  5. package/dist/esm/chunks/ContinueFlow-YFSpSOio.js +7500 -0
  6. package/dist/esm/continue.js +10 -0
  7. package/dist/esm/index.js +218 -0
  8. package/dist/esm/preview.js +368 -0
  9. package/dist/esm/workers/detector.worker-DtuL8TFY.js +22435 -0
  10. package/dist/types/continue.d.ts +3 -0
  11. package/dist/types/index.d.ts +19 -0
  12. package/dist/types/preview.d.ts +5 -0
  13. package/dist/types/react/DocumentCapture.d.ts +27 -0
  14. package/dist/types/react/FaceCapture.d.ts +19 -0
  15. package/dist/types/react/capture/ProximityMeter.d.ts +9 -0
  16. package/dist/types/react/capture/TurnGauge.d.ts +12 -0
  17. package/dist/types/react/capture/YawDial.d.ts +6 -0
  18. package/dist/types/react/capture/api.d.ts +50 -0
  19. package/dist/types/react/capture/attestation.d.ts +32 -0
  20. package/dist/types/react/capture/binding.d.ts +51 -0
  21. package/dist/types/react/capture/camera.d.ts +4 -0
  22. package/dist/types/react/capture/chrome.d.ts +24 -0
  23. package/dist/types/react/capture/demo.d.ts +2 -0
  24. package/dist/types/react/capture/errors.d.ts +18 -0
  25. package/dist/types/react/capture/frames.d.ts +18 -0
  26. package/dist/types/react/capture/index.d.ts +15 -0
  27. package/dist/types/react/capture/integrity.d.ts +32 -0
  28. package/dist/types/react/capture/keyframes.d.ts +19 -0
  29. package/dist/types/react/capture/overlays.d.ts +10 -0
  30. package/dist/types/react/capture/run.d.ts +14 -0
  31. package/dist/types/react/capture/useCaptureRun.d.ts +4 -0
  32. package/dist/types/react/document/CardFrame.d.ts +10 -0
  33. package/dist/types/react/document/DocumentParts.d.ts +49 -0
  34. package/dist/types/react/document/advisory.d.ts +47 -0
  35. package/dist/types/react/document/bestFrames.d.ts +18 -0
  36. package/dist/types/react/document/cues.d.ts +28 -0
  37. package/dist/types/react/document/flow.d.ts +52 -0
  38. package/dist/types/react/document/gate.d.ts +114 -0
  39. package/dist/types/react/document/latch.d.ts +25 -0
  40. package/dist/types/react/document/mrz.d.ts +29 -0
  41. package/dist/types/react/document/overlay.d.ts +52 -0
  42. package/dist/types/react/document/quad.d.ts +5 -0
  43. package/dist/types/react/document/resolution.d.ts +42 -0
  44. package/dist/types/react/document/review.d.ts +50 -0
  45. package/dist/types/react/document/sideCheck.d.ts +32 -0
  46. package/dist/types/react/document/telemetry.d.ts +14 -0
  47. package/dist/types/react/document/track.d.ts +36 -0
  48. package/dist/types/react/document/useDocumentCapture.d.ts +78 -0
  49. package/dist/types/react/face/FaceGuide.d.ts +22 -0
  50. package/dist/types/react/face/FaceParts.d.ts +15 -0
  51. package/dist/types/react/face/faceMesh.d.ts +68 -0
  52. package/dist/types/react/face/faceRegion.d.ts +16 -0
  53. package/dist/types/react/face/faceView.d.ts +21 -0
  54. package/dist/types/react/face/meshBench.d.ts +7 -0
  55. package/dist/types/react/face/meshCanvas.d.ts +20 -0
  56. package/dist/types/react/face/qualityGate.d.ts +59 -0
  57. package/dist/types/react/face/runLiveness.d.ts +37 -0
  58. package/dist/types/react/face/scanState.d.ts +40 -0
  59. package/dist/types/react/face/upload.d.ts +14 -0
  60. package/dist/types/react/face/useFaceCapture.d.ts +45 -0
  61. package/dist/types/react/flows/ConsentStep.d.ts +8 -0
  62. package/dist/types/react/flows/EnrollmentFlow.d.ts +2 -0
  63. package/dist/types/react/flows/FlowResult.d.ts +13 -0
  64. package/dist/types/react/flows/FlowShell.d.ts +48 -0
  65. package/dist/types/react/flows/IdentifyFlow.d.ts +2 -0
  66. package/dist/types/react/flows/ReverificationFlow.d.ts +2 -0
  67. package/dist/types/react/flows/SignInFlow.d.ts +2 -0
  68. package/dist/types/react/flows/StepIntro.d.ts +10 -0
  69. package/dist/types/react/flows/VerificationFlow.d.ts +4 -0
  70. package/dist/types/react/flows/experience.d.ts +35 -0
  71. package/dist/types/react/flows/failureDetail.d.ts +12 -0
  72. package/dist/types/react/flows/index.d.ts +6 -0
  73. package/dist/types/react/flows/session.d.ts +5 -0
  74. package/dist/types/react/flows/state.d.ts +106 -0
  75. package/dist/types/react/flows/types.d.ts +255 -0
  76. package/dist/types/react/flows/useFlowSession.d.ts +21 -0
  77. package/dist/types/react/flows.d.ts +1 -0
  78. package/dist/types/react/handoff/ContinueFlow.d.ts +28 -0
  79. package/dist/types/react/handoff/ContinueOnPhone.d.ts +60 -0
  80. package/dist/types/react/handoff/api.d.ts +41 -0
  81. package/dist/types/react/handoff/qr.d.ts +9 -0
  82. package/dist/types/react/hooks.d.ts +7 -0
  83. package/dist/types/react/i18n/en.d.ts +3 -0
  84. package/dist/types/react/i18n/es-419.d.ts +3 -0
  85. package/dist/types/react/i18n/index.d.ts +10 -0
  86. package/dist/types/react/i18n/types.d.ts +250 -0
  87. package/dist/types/react/icons.d.ts +25 -0
  88. package/dist/types/react/liveness/challenges.d.ts +26 -0
  89. package/dist/types/react/liveness/framing.d.ts +33 -0
  90. package/dist/types/react/liveness/index.d.ts +8 -0
  91. package/dist/types/react/liveness/nod.d.ts +4 -0
  92. package/dist/types/react/liveness/scoring.d.ts +29 -0
  93. package/dist/types/react/liveness/script.d.ts +7 -0
  94. package/dist/types/react/liveness/signals.d.ts +38 -0
  95. package/dist/types/react/liveness/timing.d.ts +20 -0
  96. package/dist/types/react/liveness/turn.d.ts +18 -0
  97. package/dist/types/react/preview/FlowPreview.d.ts +34 -0
  98. package/dist/types/react/preview/contrast.d.ts +17 -0
  99. package/dist/types/react/preview/specimen.d.ts +35 -0
  100. package/dist/types/react/styles/index.d.ts +0 -0
  101. package/dist/types/react/telemetry/bus.d.ts +13 -0
  102. package/dist/types/react/telemetry/device.d.ts +66 -0
  103. package/dist/types/react/telemetry/reporter.d.ts +27 -0
  104. package/dist/types/react/theme/appearance.d.ts +22 -0
  105. package/dist/types/react/version.d.ts +1 -0
  106. package/dist/types/react/vision/authenticity.d.ts +43 -0
  107. package/dist/types/react/vision/authenticityPixels.d.ts +6 -0
  108. package/dist/types/react/vision/authenticitySpecular.d.ts +2 -0
  109. package/dist/types/react/vision/cardCorners.d.ts +21 -0
  110. package/dist/types/react/vision/cardDetector.d.ts +15 -0
  111. package/dist/types/react/vision/cornerGeometry.d.ts +10 -0
  112. package/dist/types/react/vision/cornerImage.d.ts +34 -0
  113. package/dist/types/react/vision/cornerLines.d.ts +12 -0
  114. package/dist/types/react/vision/cornerScore.d.ts +17 -0
  115. package/dist/types/react/vision/corners.d.ts +60 -0
  116. package/dist/types/react/vision/detector.worker.d.ts +1 -0
  117. package/dist/types/react/vision/document.d.ts +13 -0
  118. package/dist/types/react/vision/engine.d.ts +5 -0
  119. package/dist/types/react/vision/face.d.ts +17 -0
  120. package/dist/types/react/vision/index.d.ts +7 -0
  121. package/dist/types/react/vision/modelCache.d.ts +16 -0
  122. package/dist/types/react/vision/modelsCdn.d.ts +4 -0
  123. package/dist/types/react/vision/quality.d.ts +10 -0
  124. package/dist/types/react/vision/sideClassifier.d.ts +4 -0
  125. package/dist/types/react/vision/tinyCore.d.ts +21 -0
  126. package/dist/types/react/vision/tinyDetector.d.ts +36 -0
  127. package/dist/types/react/vision/types.d.ts +62 -0
  128. package/dist/types/react/vision/warp.d.ts +18 -0
  129. package/package.json +104 -0
@@ -0,0 +1,3 @@
1
+ export { ContinueFlow, readHandoffCode, type ContinueFlowProps } from "./react/handoff/ContinueFlow";
2
+ export { DEFAULT_MODELS_URL, MODELS_VERSION } from "./react/vision/modelsCdn";
3
+ export { getStrings, LOCALES, type Locale, type Strings, type StringOverrides } from "./react/i18n";
@@ -0,0 +1,19 @@
1
+ export { EnrollmentFlow, SignInFlow, ReverificationFlow, IdentifyFlow, normalizeSession, captureNonceOf, type ApiSessionBody, type EnrollmentFlowProps, type SignInFlowProps, type ReverificationFlowProps, type IdentifyFlowProps, type Purpose, type IdentifyCandidate, type DuplicateCandidate, type VerificationFlowProps, type RpidSession, type SessionFlow, type VerificationResult, type VerificationAssessment, type DocumentAuthenticity, type RpidFlowEvent, type ExtractionRecord, type ExtractionField, type Appearance, type TenantInstructions, type TenantMessages, type SessionHandoff, type HandoffOption, } from "./react/flows";
2
+ export { ContinueOnPhone, HandoffPanel, HandoffView, type ContinueOnPhoneProps, type HandoffMode, type HandoffCopy, } from "./react/handoff/ContinueOnPhone";
3
+ export { ContinueFlow, readHandoffCode, type ContinueFlowProps } from "./react/handoff/ContinueFlow";
4
+ export { createHandoff, handoffStatus, revokeHandoff, peekHandoff, claimHandoff, type HandoffCode, type HandoffStatus, type HandoffPhase, type HandoffPeek, } from "./react/handoff/api";
5
+ export { encodeQr, qrPath, type QrMatrix } from "./react/handoff/qr";
6
+ export { detectDevice, collectSnapshot, parseUserAgent, inAppBrowser, type DeviceKind, type DeviceReading } from "./react/telemetry/device";
7
+ export { reportClient, subscribeClient, type ClientEvent, type ClientEventType } from "./react/telemetry/bus";
8
+ export { SDK_VERSION } from "./react/version";
9
+ export { DocumentCapture, type DocumentCaptureProps, type SideRetake } from "./react/DocumentCapture";
10
+ export { sideOutcomeOf, type SideOutcome } from "./react/document/sideCheck";
11
+ export { FaceCapture, type FaceCaptureProps } from "./react/FaceCapture";
12
+ export { selfieQualityIssue, faceCropStats, floorsFrom, SELFIE_QUALITY_DEFAULTS, type SelfieQualityFloors, type SelfieQualityReading, type QualityIssue, } from "./react/face/qualityGate";
13
+ export { finalizeSession, uploadCapture, probeDocument, type Quality, type RpidClientConfig, type MrzProbe, } from "./react/capture";
14
+ export { webAttestation, nativeAttestation, requestHash, type AttestationProvider, type AttestationClaim, type AttestationName, type NativeMint, } from "./react/capture";
15
+ export { preload, loadDocumentEngine, loadFaceEngine, cropQuality, DEFAULT_DETECTOR, type DetectorChoice, DEFAULT_MODELS_URL, MODELS_VERSION, modelsUrlOf, specularSignature, gridPeriodicity, cornerRadius, type PixelData, type CropSample, type CardOutline, type SpecularSignature, type CardDetection, type SideResult, type CropQuality, type FaceCentering, type EngineProgress, type ProgressFn, } from "./react/vision";
16
+ export { EngineLoading, ProcessingOverlay, ProximityMeter, TurnGauge, YawDial, turnGaugeFrom, } from "./react/capture";
17
+ export { proximityOf, distanceHintOf, distanceTrackPos, centeringFrom, centerBlocker, YAW_TARGET, CENTER_MIN, CONTAIN_MIN, FACE_W_MIN, FACE_W_MAX, FACE_W_COMFORT_MIN, FACE_W_COMFORT_MAX, faceWidthOf, type Proximity, type CenterBlocker, } from "./react/liveness";
18
+ export { getStrings, reasonEntry, resolveLocale, browserLocale, DEFAULT_LOCALE, LOCALES, type Locale, type Strings, type StringOverrides, type Reason, type ClientReason, type ServerReason, type ReasonEntry, type Recovery, type GuideKey, type EngineStage, type DistanceHint, } from "./react/i18n";
19
+ export { meshBenchmark, type MeshBench } from "./react/face/meshBench";
@@ -0,0 +1,5 @@
1
+ export { FlowPreview, type FlowPreviewProps, type PreviewScreen, type PreviewChallenge, type PreviewHandoff, } from "./react/preview/FlowPreview";
2
+ export { appearanceStyle, appearanceGroups, FONT_STACKS, SDK_DEFAULTS, type Appearance, type ColorKey, type SafeFont, } from "./react/theme/appearance";
3
+ export { contrastChecks, contrastRatio, DEFAULT_COLORS, DEFAULT_RADIUS, CONTRAST_PAIRS, type ContrastCheck, } from "./react/preview/contrast";
4
+ export { parseIntroBody, introFor, type TenantInstructions, type TenantMessages } from "./react/flows/experience";
5
+ export { getStrings, LOCALES, type Locale, type Strings } from "./react/i18n";
@@ -0,0 +1,27 @@
1
+ import { type Locale, type StringOverrides } from "./i18n";
2
+ import { type RpidClientConfig } from "./capture";
3
+ import type { SideOutcome } from "./document/sideCheck";
4
+ export type SideRetake = Extract<SideOutcome, {
5
+ kind: "retake";
6
+ }> & {
7
+ side: "front" | "back";
8
+ detail: unknown;
9
+ };
10
+ export interface DocumentCaptureProps {
11
+ config: RpidClientConfig;
12
+ side: "front" | "back";
13
+ source?: "camera" | "demo";
14
+ locale?: Locale;
15
+ strings?: StringOverrides;
16
+ modelsUrl?: string;
17
+ prompt?: string;
18
+ debug?: boolean;
19
+ documentFrames?: number;
20
+ captureNonce?: string | null;
21
+ confirmCapture?: boolean;
22
+ detector?: "tiny" | "legacy";
23
+ onCaptured: (serverResult: unknown, thumbnailDataUrl?: string) => void;
24
+ onRejected?: (reason: string, detail?: unknown) => void;
25
+ onRetake?: (retake: SideRetake) => void;
26
+ }
27
+ export declare function DocumentCapture(props: DocumentCaptureProps): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { type Locale, type StringOverrides } from "./i18n";
2
+ import { type AttestationProvider, type RpidClientConfig } from "./capture";
3
+ import type { SelfieQualityFloors } from "./face/qualityGate";
4
+ export interface FaceCaptureProps {
5
+ config: RpidClientConfig;
6
+ challengeScript: string[];
7
+ source?: "camera" | "demo";
8
+ locale?: Locale;
9
+ strings?: StringOverrides;
10
+ debug?: boolean;
11
+ modelsUrl?: string;
12
+ challengeMs?: number;
13
+ quality?: Partial<Record<keyof SelfieQualityFloors, number | null>> | null;
14
+ captureNonce?: string | null;
15
+ attestation?: AttestationProvider;
16
+ onCaptured: (serverResult: unknown) => void;
17
+ onRejected?: (reason: string, detail?: unknown) => void;
18
+ }
19
+ export declare function FaceCapture(props: FaceCaptureProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { type Proximity } from "../liveness";
2
+ import type { Strings } from "../i18n";
3
+ export declare function ProximityMeter({ centered, faceW, proximity, found, strings, }: {
4
+ centered: number;
5
+ faceW: number;
6
+ proximity: Proximity;
7
+ found: boolean;
8
+ strings: Strings;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { Strings } from "../i18n";
2
+ export declare function TurnGauge({ direction, progress, wrongWay, confidence, strings, }: {
3
+ direction: "left" | "right";
4
+ progress: number;
5
+ wrongWay: boolean;
6
+ confidence?: number;
7
+ strings: Strings;
8
+ }): import("react").JSX.Element;
9
+ export declare function turnGaugeFrom(yaw: number, direction: "left" | "right"): {
10
+ progress: number;
11
+ wrongWay: boolean;
12
+ };
@@ -0,0 +1,6 @@
1
+ export declare function YawDial({ yaw, target, reached, confidence, }: {
2
+ yaw: number;
3
+ target: number;
4
+ reached: boolean;
5
+ confidence?: number;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,50 @@
1
+ export { type DocumentAuthenticity, type Rejection, authenticityOf, errorCode, isAbort, rejectionOf } from "./errors";
2
+ export interface RpidClientConfig {
3
+ apiUrl: string;
4
+ sessionId: string;
5
+ captureToken: string;
6
+ }
7
+ export type Json = Record<string, unknown>;
8
+ export interface CaptureUpload {
9
+ side?: "front" | "back";
10
+ meta?: Record<string, unknown>;
11
+ mrzReadings?: string[];
12
+ capture?: Record<string, unknown> | null;
13
+ keyframes?: Blob[];
14
+ frames?: Blob[];
15
+ edgeAuthenticity?: Record<string, unknown> | object | null;
16
+ signal?: AbortSignal;
17
+ }
18
+ export declare function uploadCaptureSignal(cfg: RpidClientConfig, kind: "document" | "face", blob: Blob, { side, meta, mrzReadings, capture, keyframes, frames, edgeAuthenticity, signal }?: CaptureUpload): Promise<any>;
19
+ export declare function uploadCapture(cfg: RpidClientConfig, kind: "document" | "face", blob: Blob, side?: "front" | "back", meta?: Record<string, unknown>, mrzReadings?: string[]): Promise<any>;
20
+ export declare function finalizeSessionSignal(cfg: RpidClientConfig, signal?: AbortSignal): Promise<any>;
21
+ export declare function finalizeSession(cfg: RpidClientConfig): Promise<any>;
22
+ export interface MrzProbe {
23
+ available: boolean;
24
+ mrz: {
25
+ found: boolean;
26
+ raw_text?: string | null;
27
+ type?: string | null;
28
+ valid?: boolean;
29
+ fields_valid?: boolean;
30
+ score?: number | null;
31
+ checks?: Record<string, boolean>;
32
+ failed?: string[];
33
+ fields?: Record<string, string | null>;
34
+ };
35
+ screen?: {
36
+ available: boolean;
37
+ score: number;
38
+ verdict: string;
39
+ calibrated?: boolean;
40
+ mode?: string;
41
+ signals?: Record<string, number>;
42
+ };
43
+ elapsed_ms?: number;
44
+ retries_left?: number;
45
+ finalized?: boolean;
46
+ verdict?: "REJECTED" | "NEEDS_REVIEW";
47
+ reason?: string;
48
+ }
49
+ export declare function probeDocumentSignal(cfg: RpidClientConfig, blob: Blob, signal?: AbortSignal): Promise<MrzProbe | null>;
50
+ export declare function probeDocument(cfg: RpidClientConfig, blob: Blob): Promise<MrzProbe | null>;
@@ -0,0 +1,32 @@
1
+ import { type DeviceSignals } from "./integrity";
2
+ export type AttestationName = "web" | "play_integrity" | "app_attest";
3
+ export type AttestationClaim = {
4
+ provider: "web";
5
+ v: 1;
6
+ device: DeviceSignals;
7
+ } | {
8
+ provider: "play_integrity";
9
+ v: 1;
10
+ request_hash: string;
11
+ token: string;
12
+ } | {
13
+ provider: "app_attest";
14
+ v: 1;
15
+ request_hash: string;
16
+ key_id: string;
17
+ assertion: string;
18
+ attestation?: string;
19
+ };
20
+ export interface AttestationInput {
21
+ nonce: string;
22
+ digest: string;
23
+ stream: MediaStream | null;
24
+ }
25
+ export interface AttestationProvider {
26
+ readonly name: AttestationName;
27
+ claim(input: AttestationInput): Promise<AttestationClaim>;
28
+ }
29
+ export declare function requestHash(nonce: string, digest: string): Promise<string>;
30
+ export declare const webAttestation: AttestationProvider;
31
+ export type NativeMint = (requestHashHex: string) => Promise<Record<string, string>>;
32
+ export declare function nativeAttestation(name: "play_integrity" | "app_attest", mint: NativeMint): AttestationProvider;
@@ -0,0 +1,51 @@
1
+ import type { AttestationClaim } from "./attestation";
2
+ import type { DeviceSignals } from "./integrity";
3
+ export interface TimelineSummary {
4
+ duration_ms: number;
5
+ frames: number;
6
+ interval_mean_ms: number;
7
+ interval_sd_ms: number;
8
+ interval_min_ms: number;
9
+ interval_max_ms: number;
10
+ challenge_ms: number[];
11
+ }
12
+ export declare class FrameTimeline {
13
+ private first;
14
+ private last;
15
+ private n;
16
+ private sum;
17
+ private sumSq;
18
+ private min;
19
+ private max;
20
+ private marks;
21
+ tick(now: number): void;
22
+ mark(now: number): void;
23
+ summary(now: number): TimelineSummary;
24
+ }
25
+ export declare function subtleCrypto(): SubtleCrypto | null;
26
+ export declare function sha256Hex(bytes: ArrayBuffer): Promise<string>;
27
+ export declare function hmacSha256Hex(key: string, message: string): Promise<string>;
28
+ export interface KeyframeRef {
29
+ tag: string;
30
+ t_ms: number;
31
+ digest: string;
32
+ }
33
+ export interface CaptureBlock {
34
+ v: 1 | 2;
35
+ nonce: string;
36
+ digest: string;
37
+ mac: string;
38
+ timeline: TimelineSummary;
39
+ device: DeviceSignals | null;
40
+ keyframes?: KeyframeRef[];
41
+ attestation?: AttestationClaim | null;
42
+ }
43
+ export declare function macMessage(digest: string, timeline: Pick<TimelineSummary, "duration_ms" | "frames">, keyframeDigests?: readonly string[]): string;
44
+ export declare function captureBlock(nonce: string, bytes: ArrayBuffer, timeline: TimelineSummary, device: DeviceSignals | null, extra?: {
45
+ keyframes?: {
46
+ tag: string;
47
+ t_ms: number;
48
+ bytes: ArrayBuffer;
49
+ }[];
50
+ attestation?: AttestationClaim | null;
51
+ }): Promise<CaptureBlock | null>;
@@ -0,0 +1,4 @@
1
+ export type CameraProfile = "default" | "document";
2
+ export declare function cameraConstraints(facing: "environment" | "user", profile: CameraProfile): MediaTrackConstraints;
3
+ export declare function openCamera(video: HTMLVideoElement, facing?: "environment" | "user", profile?: CameraProfile): Promise<MediaStream>;
4
+ export declare function stopStream(stream: MediaStream | null | undefined): void;
@@ -0,0 +1,24 @@
1
+ import { type CSSProperties, type ReactNode, type RefObject } from "react";
2
+ export declare function CaptureViewport({ className, source, videoRef, canvasRef, mirror, attrs, style, children, }: {
3
+ className: string;
4
+ style?: CSSProperties;
5
+ source: "camera" | "demo";
6
+ videoRef: RefObject<HTMLVideoElement | null>;
7
+ canvasRef: RefObject<HTMLCanvasElement | null>;
8
+ mirror?: boolean;
9
+ attrs?: Record<`data-${string}`, string>;
10
+ children: ReactNode;
11
+ }): import("react").JSX.Element;
12
+ export declare function Guide({ tone, children, marker, }: {
13
+ tone: "info" | "ok" | "warn";
14
+ children: ReactNode;
15
+ marker?: boolean;
16
+ }): import("react").JSX.Element;
17
+ export declare function RetryButton({ label, onRetry }: {
18
+ label: string;
19
+ onRetry: () => void;
20
+ }): import("react").JSX.Element;
21
+ export declare function Telemetry({ phase, text }: {
22
+ phase: string;
23
+ text: string;
24
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare function demoDocumentFrame(canvas: HTMLCanvasElement, side: "front" | "back", settled: number): void;
2
+ export declare function demoFaceFrame(canvas: HTMLCanvasElement, settled: number): void;
@@ -0,0 +1,18 @@
1
+ import type { Json } from "./api";
2
+ export declare function errorCode(e: unknown, fallback: string): string;
3
+ export interface Rejection {
4
+ retriesLeft: number | null;
5
+ finalized: boolean;
6
+ verdict?: "REJECTED" | "NEEDS_REVIEW";
7
+ reason?: string;
8
+ body: Json;
9
+ }
10
+ export declare function rejectionOf(e: unknown): Rejection;
11
+ export interface DocumentAuthenticity {
12
+ score: number;
13
+ flags: Array<"screen" | "paper" | "tampering" | "damage" | (string & {})>;
14
+ signals?: Record<string, number>;
15
+ model?: string;
16
+ }
17
+ export declare function authenticityOf(e: unknown): DocumentAuthenticity | undefined;
18
+ export declare const isAbort: (e: unknown) => boolean;
@@ -0,0 +1,18 @@
1
+ export interface Quality {
2
+ sharpness: number;
3
+ glare: number;
4
+ fill: number;
5
+ }
6
+ export interface ProbeRegion {
7
+ x: number;
8
+ y: number;
9
+ w: number;
10
+ h: number;
11
+ }
12
+ export declare function moireProbe(canvas: HTMLCanvasElement, region?: number | ProbeRegion): number;
13
+ export declare function analyzeFrame(canvas: HTMLCanvasElement): Quality;
14
+ export declare function grabFrame(video: HTMLVideoElement | null, canvas: HTMLCanvasElement, maxLong?: number): boolean;
15
+ export declare function readPixels(canvas: HTMLCanvasElement, region: ProbeRegion): ImageData | null;
16
+ export declare function canvasToJpeg(canvas: HTMLCanvasElement): Promise<Blob>;
17
+ export declare function thumbnailOf(source: HTMLCanvasElement, width?: number): string | undefined;
18
+ export declare function haptic(ms: number): void;
@@ -0,0 +1,15 @@
1
+ export { uploadCapture, finalizeSession, probeDocument, uploadCaptureSignal, finalizeSessionSignal, probeDocumentSignal, errorCode, isAbort, rejectionOf, authenticityOf, type RpidClientConfig, type MrzProbe, type CaptureUpload, type Rejection, type DocumentAuthenticity, } from "./api";
2
+ export { openCamera, stopStream, cameraConstraints, type CameraProfile } from "./camera";
3
+ export { analyzeFrame, moireProbe, grabFrame, canvasToJpeg, thumbnailOf, readPixels, haptic, type Quality, type ProbeRegion, } from "./frames";
4
+ export { demoDocumentFrame, demoFaceFrame } from "./demo";
5
+ export { createCaptureRun, frameLoop, nextFrame, type CaptureRun, type TickResult } from "./run";
6
+ export { useCaptureRun, useLatest } from "./useCaptureRun";
7
+ export { CaptureViewport, Guide, RetryButton, Telemetry } from "./chrome";
8
+ export { EngineLoading, ProcessingOverlay, engineTelemetry } from "./overlays";
9
+ export { ProximityMeter } from "./ProximityMeter";
10
+ export { TurnGauge, turnGaugeFrom } from "./TurnGauge";
11
+ export { YawDial } from "./YawDial";
12
+ export { collectDevice, deviceSignals, virtualCameraFamily, type DeviceSignals, type DeviceInput } from "./integrity";
13
+ export { FrameTimeline, captureBlock, macMessage, sha256Hex, hmacSha256Hex, type CaptureBlock, type KeyframeRef, type TimelineSummary, } from "./binding";
14
+ export { KeyframeRecorder, keyframeSize, admit as admitKeyframe, MAX_KEYFRAMES, KEYFRAME_MAX_SIDE, type Keyframe } from "./keyframes";
15
+ export { webAttestation, nativeAttestation, requestHash, type AttestationProvider, type AttestationClaim, type AttestationName, type NativeMint, } from "./attestation";
@@ -0,0 +1,32 @@
1
+ export declare const VIRTUAL_CAMERA_PATTERNS: ReadonlyArray<readonly [string, RegExp]>;
2
+ export interface DeviceInput {
3
+ label?: string;
4
+ settings?: {
5
+ width?: number;
6
+ height?: number;
7
+ frameRate?: number;
8
+ facingMode?: string;
9
+ resizeMode?: string;
10
+ };
11
+ webdriver?: boolean;
12
+ userAgent?: string;
13
+ maxTouchPoints?: number;
14
+ glRenderer?: string | null;
15
+ }
16
+ export interface DeviceSignals {
17
+ virtual_camera: boolean;
18
+ label_family: string | null;
19
+ webdriver: boolean;
20
+ headless: boolean;
21
+ emulator: string[];
22
+ track: {
23
+ width?: number;
24
+ height?: number;
25
+ frameRate?: number;
26
+ facingMode?: string;
27
+ resizeMode?: string;
28
+ };
29
+ }
30
+ export declare function virtualCameraFamily(label: string | undefined): string | null;
31
+ export declare function deviceSignals(input: DeviceInput): DeviceSignals;
32
+ export declare function collectDevice(stream: MediaStream | null): DeviceSignals;
@@ -0,0 +1,19 @@
1
+ export declare const MAX_KEYFRAMES = 5;
2
+ export declare const KEYFRAME_MAX_SIDE = 480;
3
+ export declare const KEYFRAME_QUALITY = 0.8;
4
+ export interface Keyframe {
5
+ tag: string;
6
+ t_ms: number;
7
+ blob: Blob;
8
+ }
9
+ export declare function keyframeSize(w: number, h: number, maxSide?: number): {
10
+ w: number;
11
+ h: number;
12
+ };
13
+ export declare function admit(tags: readonly string[], tag: string, max?: number): boolean;
14
+ export declare class KeyframeRecorder {
15
+ private pending;
16
+ private tags;
17
+ grab(video: HTMLVideoElement | null, tag: string, tMs: number): void;
18
+ collect(): Promise<Keyframe[]>;
19
+ }
@@ -0,0 +1,10 @@
1
+ import type { Strings } from "../i18n";
2
+ import type { EngineProgress } from "../vision";
3
+ export declare const engineTelemetry: (t: Strings, p: EngineProgress) => string;
4
+ export declare function EngineLoading({ progress, strings, }: {
5
+ progress: EngineProgress | null;
6
+ strings: Strings;
7
+ }): import("react").JSX.Element;
8
+ export declare function ProcessingOverlay({ strings }: {
9
+ strings: Strings;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ export interface CaptureRun {
2
+ readonly signal: AbortSignal;
3
+ alive(): boolean;
4
+ wait(ms: number): Promise<void>;
5
+ later(ms: number, fn: () => void): void;
6
+ every(ms: number, fn: () => void): void;
7
+ hold(stream: MediaStream): MediaStream;
8
+ defer(fn: () => void): void;
9
+ dispose(): void;
10
+ }
11
+ export declare function createCaptureRun(): CaptureRun;
12
+ export type TickResult = "stop" | void;
13
+ export declare function frameLoop(run: CaptureRun, intervalMs: number, tick: () => TickResult | Promise<TickResult>): void;
14
+ export declare function nextFrame(run: CaptureRun, maxMs?: number): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { type DependencyList } from "react";
2
+ import { type CaptureRun } from "./run";
3
+ export declare function useCaptureRun(body: (run: CaptureRun) => void | Promise<void>, deps: DependencyList): void;
4
+ export declare function useLatest<T>(value: T): import("react").MutableRefObject<T>;
@@ -0,0 +1,10 @@
1
+ import type { Strings } from "../i18n";
2
+ import type { QuadSource } from "./track";
3
+ export type FrameState = "searching" | "tracking" | "holding" | "locked";
4
+ export declare function CardFrame({ source, pct, state, label, t, }: {
5
+ source: QuadSource | null;
6
+ pct: number;
7
+ state: FrameState;
8
+ label?: string;
9
+ t?: Strings;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1,49 @@
1
+ import type { Strings } from "../i18n";
2
+ import type { MrzProbe } from "../capture";
3
+ import type { Chip } from "./gate";
4
+ import type { MrzStage } from "./mrz";
5
+ import type { CardInset, Review } from "./review";
6
+ import { type SideOutcome } from "./sideCheck";
7
+ export { CardFrame, type FrameState } from "./CardFrame";
8
+ export declare function CardSnapshot({ url, aspect, from, t }: {
9
+ url: string;
10
+ aspect: number;
11
+ from: {
12
+ l: number;
13
+ t: number;
14
+ r: number;
15
+ b: number;
16
+ } | null;
17
+ t: Strings;
18
+ }): import("react").JSX.Element;
19
+ export declare function CaptureReview({ image, aspect, review, t, confirm, outline }: {
20
+ image: string;
21
+ aspect: number;
22
+ review: Review;
23
+ t: Strings;
24
+ confirm?: boolean;
25
+ outline?: CardInset | null;
26
+ }): import("react").JSX.Element;
27
+ export declare function ReviewSheet({ review, t, confirm }: {
28
+ review: Review;
29
+ t: Strings;
30
+ confirm?: boolean;
31
+ }): import("react").JSX.Element;
32
+ export declare function QualityChips({ chips, t }: {
33
+ chips: Chip[];
34
+ t: Strings;
35
+ }): import("react").JSX.Element;
36
+ export declare function MrzStatus({ stage, mrz, t }: {
37
+ stage: MrzStage;
38
+ mrz: MrzProbe["mrz"] | null;
39
+ t: Strings;
40
+ }): import("react").JSX.Element | null;
41
+ export declare function RetakePanel({ outcome, side, t, onRetake, onContinue, }: {
42
+ outcome: Exclude<SideOutcome, {
43
+ kind: "ok";
44
+ }>;
45
+ side: "front" | "back";
46
+ t: Strings;
47
+ onRetake: () => void;
48
+ onContinue: () => void;
49
+ }): import("react").JSX.Element;
@@ -0,0 +1,47 @@
1
+ import type { AuthenticityCue } from "./gate";
2
+ import type { SpecularSignature } from "../vision/authenticity";
3
+ export type Advisory = "screen" | "paper";
4
+ export declare const HINT_AFTER_TICKS = 3;
5
+ export declare const HINT_MS = 4000;
6
+ export interface AdvisoryReading {
7
+ cue: AuthenticityCue | null;
8
+ moire: number;
9
+ grid: number;
10
+ texture: number;
11
+ specular: SpecularSignature;
12
+ corner: number | null;
13
+ }
14
+ export interface EdgeAuthenticitySummary {
15
+ v: 1;
16
+ model: string;
17
+ ticks: number;
18
+ raised: {
19
+ screen: number;
20
+ paper: number;
21
+ };
22
+ advisory: Advisory | null;
23
+ hinted: boolean;
24
+ moire_max: number;
25
+ grid_max: number;
26
+ texture_max: number;
27
+ gloss: number | null;
28
+ static: number | null;
29
+ specular_frames: number;
30
+ corner: number | null;
31
+ }
32
+ export declare const EDGE_AUTH_MODEL = "edge-auth-v2-advisory";
33
+ export declare const advisoryOf: (cue: AuthenticityCue | null) => Advisory | null;
34
+ export declare class AdvisoryLog {
35
+ private ticks;
36
+ private raised;
37
+ private run;
38
+ private persisted;
39
+ private hinted;
40
+ private moireMax;
41
+ private gridMax;
42
+ private textureMax;
43
+ private last;
44
+ record(r: AdvisoryReading): Advisory | null;
45
+ summary(): EdgeAuthenticitySummary;
46
+ interrupt(): void;
47
+ }
@@ -0,0 +1,18 @@
1
+ export declare const DEFAULT_DOCUMENT_FRAMES = 3;
2
+ export declare const MAX_DOCUMENT_FRAMES = 5;
3
+ export declare function frameScore(detConfidence: number, sideConfidence: number, blurScore: number): number;
4
+ export declare function frameCount(n: number | undefined): number;
5
+ export interface Ranked<T> {
6
+ item: T;
7
+ score: number;
8
+ t: number;
9
+ }
10
+ export declare class BestFrames<T> {
11
+ private readonly n;
12
+ private kept;
13
+ constructor(n: number);
14
+ wouldAdmit(score: number): boolean;
15
+ offer(item: T, score: number, t: number): void;
16
+ ranked(): Ranked<T>[];
17
+ clear(): void;
18
+ }
@@ -0,0 +1,28 @@
1
+ import type { CropQuality } from "../vision";
2
+ import { type SpecularSignature } from "../vision/authenticity";
3
+ import { type GuideId } from "./gate";
4
+ export interface CardReading {
5
+ side: "front" | "back";
6
+ areaFrac: number;
7
+ aspect: number;
8
+ sideConfidence: number;
9
+ moire: number;
10
+ quality: Pick<CropQuality, "isBlurred" | "hasGlare" | "lighting">;
11
+ grid?: number;
12
+ specular?: SpecularSignature;
13
+ corner?: number | null;
14
+ texture?: number;
15
+ cardPx?: number;
16
+ needPx?: number;
17
+ outline?: {
18
+ aspect: number;
19
+ tilt: number;
20
+ } | null;
21
+ lowContrast?: boolean;
22
+ }
23
+ export type AuthenticityCue = "moire" | "grid" | "static" | "paper";
24
+ export declare function screenCue(r: Pick<CardReading, "moire" | "grid" | "specular">): AuthenticityCue | null;
25
+ export declare function paperCue(r: Pick<CardReading, "specular" | "corner" | "texture">): boolean;
26
+ export declare function authenticityCue(r: CardReading): AuthenticityCue | null;
27
+ export declare function cardIssue(r: CardReading): GuideId | null;
28
+ export declare const holdFraction: (since: number, now: number, holdMs?: number) => number;
@@ -0,0 +1,52 @@
1
+ import { type Box, type Pt, type Quad } from "./overlay";
2
+ export declare const FLOW_W = 160;
3
+ export declare const FLOW_R = 8;
4
+ export declare const FLOW_MIN_CONTRAST = 0.12;
5
+ export interface Gray {
6
+ data: Uint8Array;
7
+ w: number;
8
+ h: number;
9
+ }
10
+ export interface Rect {
11
+ x: number;
12
+ y: number;
13
+ w: number;
14
+ h: number;
15
+ }
16
+ export declare function lumaOf(rgba: Uint8ClampedArray | Uint8Array, w: number, h: number): Gray;
17
+ export declare function half(g: Gray): Gray;
18
+ export declare function matchShift(prev: Gray, cur: Gray, roi: Rect, R?: number, guess?: {
19
+ dx: number;
20
+ dy: number;
21
+ }): {
22
+ dx: number;
23
+ dy: number;
24
+ ok: boolean;
25
+ };
26
+ export declare function flowRoi(b: Box, scale: number, shrink?: number): Rect;
27
+ export declare class FlowTimeline {
28
+ private ts;
29
+ private xs;
30
+ private ys;
31
+ private ox;
32
+ private oy;
33
+ push(t: number, dx: number, dy: number): void;
34
+ at(t: number): Pt;
35
+ reset(): void;
36
+ }
37
+ export declare const REANCHOR = 0.12;
38
+ export declare const READING_WEIGHT = 0.6;
39
+ export declare class AnchoredQuad {
40
+ private readonly flow;
41
+ private q;
42
+ private o;
43
+ private pending;
44
+ constructor(flow: FlowTimeline);
45
+ read(q: Quad, t: number, opts?: {
46
+ force?: boolean;
47
+ weight?: number;
48
+ }): void;
49
+ at(now: number): Quad | null;
50
+ box(now: number): Box | null;
51
+ reset(): void;
52
+ }