@baas-id/react 0.3.5 → 0.3.7

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 (49) hide show
  1. package/README.md +27 -3
  2. package/dist/esm/baas-id-react.css +1 -1
  3. package/dist/esm/chunks/ContinueFlow-BzKnkzHf.js +11597 -0
  4. package/dist/esm/chunks/provider-DqpgUBfH.js +87 -0
  5. package/dist/esm/continue.js +11 -7
  6. package/dist/esm/index.js +156 -119
  7. package/dist/esm/native.js +91 -0
  8. package/dist/esm/preview.js +220 -181
  9. package/dist/types/continue.d.ts +3 -0
  10. package/dist/types/index.d.ts +10 -1
  11. package/dist/types/native.d.ts +38 -0
  12. package/dist/types/react/DocumentCapture.d.ts +1 -0
  13. package/dist/types/react/FingerCapture.d.ts +20 -0
  14. package/dist/types/react/capture/api.d.ts +53 -0
  15. package/dist/types/react/capture/camera.d.ts +1 -1
  16. package/dist/types/react/capture/demo.d.ts +10 -0
  17. package/dist/types/react/capture/index.d.ts +3 -2
  18. package/dist/types/react/capture/torch.d.ts +14 -0
  19. package/dist/types/react/chip/ChipRead.d.ts +21 -0
  20. package/dist/types/react/chip/capability.d.ts +11 -0
  21. package/dist/types/react/chip/evidence.d.ts +9 -0
  22. package/dist/types/react/chip/provider.d.ts +42 -0
  23. package/dist/types/react/chip/useChipRead.d.ts +32 -0
  24. package/dist/types/react/chip/webNfcPresence.d.ts +2 -0
  25. package/dist/types/react/document/DocumentParts.d.ts +1 -0
  26. package/dist/types/react/face/useFaceCapture.d.ts +6 -0
  27. package/dist/types/react/finger/FingerGuide.d.ts +14 -0
  28. package/dist/types/react/finger/detector.d.ts +39 -0
  29. package/dist/types/react/finger/qualityGate.d.ts +37 -0
  30. package/dist/types/react/finger/runFingerCapture.d.ts +77 -0
  31. package/dist/types/react/finger/upload.d.ts +10 -0
  32. package/dist/types/react/finger/useFingerCapture.d.ts +31 -0
  33. package/dist/types/react/flows/experience.d.ts +4 -0
  34. package/dist/types/react/flows/index.d.ts +1 -1
  35. package/dist/types/react/flows/renewal.d.ts +27 -0
  36. package/dist/types/react/flows/session.d.ts +5 -1
  37. package/dist/types/react/flows/state.d.ts +34 -2
  38. package/dist/types/react/flows/types.d.ts +57 -0
  39. package/dist/types/react/flows/useFlowSession.d.ts +12 -2
  40. package/dist/types/react/handoff/ContinueFlow.d.ts +6 -2
  41. package/dist/types/react/handoff/api.d.ts +3 -2
  42. package/dist/types/react/handoff/phoneLink.d.ts +2 -1
  43. package/dist/types/react/i18n/types.d.ts +40 -3
  44. package/dist/types/react/preview/FlowPreview.d.ts +1 -0
  45. package/dist/types/react/telemetry/bus.d.ts +1 -1
  46. package/dist/types/react/version.d.ts +1 -1
  47. package/dist/types/react/vision/resample.d.ts +7 -0
  48. package/package.json +6 -1
  49. package/dist/esm/chunks/ContinueFlow-C2PNt2ZN.js +0 -10122
@@ -0,0 +1,38 @@
1
+ import { ChipReadError, type ChipReader, type ChipReadProgress } from "./react/chip/provider";
2
+ export { ChipReadError, type ChipReader, type ChipReadout, type ChipReadInput, type ChipReadProgress, type ChipReaderName, type ChipReadErrorCode, } from "./react/chip/provider";
3
+ export interface BaasNfcReadOptions {
4
+ mrz?: {
5
+ documentNumber: string;
6
+ birthDate: string;
7
+ expiryDate: string;
8
+ };
9
+ can?: string;
10
+ dataGroups: string[];
11
+ aaChallenge?: string;
12
+ chipAuthentication?: boolean;
13
+ timeoutMs?: number;
14
+ preferPace?: boolean;
15
+ sessionMessage?: string;
16
+ }
17
+ export interface BaasNfcReadResult {
18
+ access: "bac" | "pace";
19
+ sod: string;
20
+ dataGroups: Record<string, string>;
21
+ aaSignature?: string;
22
+ timings?: Record<string, number>;
23
+ }
24
+ export interface BaasNfcLike {
25
+ readDocument(options: BaasNfcReadOptions): Promise<BaasNfcReadResult>;
26
+ cancel(): Promise<void>;
27
+ addListener(eventName: "progress", listener: (p: ChipReadProgress) => void): Promise<{
28
+ remove(): Promise<void> | void;
29
+ }>;
30
+ }
31
+ export interface CapacitorChipReaderOptions {
32
+ timeoutMs?: number;
33
+ sessionMessage?: string;
34
+ chipAuthentication?: boolean;
35
+ preferPace?: boolean;
36
+ }
37
+ export declare function chipErrorFromPlugin(e: unknown): ChipReadError;
38
+ export declare function capacitorChipReader(plugin: BaasNfcLike, name: "native_android" | "native_ios", options?: CapacitorChipReaderOptions): ChipReader;
@@ -19,6 +19,7 @@ export interface DocumentCaptureProps {
19
19
  documentFrames?: number;
20
20
  captureNonce?: string | null;
21
21
  confirmCapture?: boolean;
22
+ unreadableHint?: boolean;
22
23
  flip?: boolean;
23
24
  detector?: "tiny" | "legacy";
24
25
  onCaptured: (serverResult: unknown, thumbnailDataUrl?: string) => void;
@@ -0,0 +1,20 @@
1
+ import { type RpidClientConfig } from "./capture";
2
+ import { type Locale, type StringOverrides } from "./i18n";
3
+ import type { FingerPosition } from "./flows/types";
4
+ import type { FingerDetector } from "./finger/detector";
5
+ export interface FingerCaptureProps {
6
+ config: RpidClientConfig;
7
+ finger: {
8
+ fingers: FingerPosition[];
9
+ torch?: boolean;
10
+ };
11
+ source?: "camera" | "demo";
12
+ locale?: Locale;
13
+ strings?: StringOverrides;
14
+ debug?: boolean;
15
+ captureNonce?: string | null;
16
+ detector?: FingerDetector;
17
+ onCaptured: (serverResult: unknown) => void;
18
+ onRejected?: (reason: string, detail?: unknown) => void;
19
+ }
20
+ export declare function FingerCapture(props: FingerCaptureProps): import("react").JSX.Element;
@@ -66,3 +66,56 @@ export interface MrzProbe {
66
66
  }
67
67
  export declare function probeDocumentSignal(cfg: RpidClientConfig, blob: Blob, signal?: AbortSignal): Promise<MrzProbe | null>;
68
68
  export declare function probeDocument(cfg: RpidClientConfig, blob: Blob): Promise<MrzProbe | null>;
69
+ export interface ChipFile {
70
+ name: "sod" | `dg${number}`;
71
+ bytes: Uint8Array;
72
+ }
73
+ export declare const CHIP_OPTIONAL_GROUPS: readonly [11, 12, 14, 15];
74
+ export declare function chipFiles(readout: {
75
+ sod: Uint8Array;
76
+ dataGroups: Record<string, Uint8Array>;
77
+ }): ChipFile[];
78
+ export declare function concatBytes(parts: readonly Uint8Array[]): ArrayBuffer;
79
+ export declare function base64Of(bytes: Uint8Array): string;
80
+ export interface ChipUploadMeta {
81
+ reader: "native_android" | "native_ios" | "desktop_reader";
82
+ }
83
+ export declare function uploadChipSignal(cfg: RpidClientConfig, readout: {
84
+ access: "bac" | "pace";
85
+ sod: Uint8Array;
86
+ dataGroups: Record<string, Uint8Array>;
87
+ aaSignature?: Uint8Array;
88
+ timings?: Record<string, number>;
89
+ }, meta: ChipUploadMeta, { capture, signal }?: {
90
+ capture?: Record<string, unknown> | null;
91
+ signal?: AbortSignal;
92
+ }): Promise<any>;
93
+ export declare const uploadChip: typeof uploadChipSignal;
94
+ export declare function reportChipUnavailable(cfg: RpidClientConfig, status: "unavailable" | "skipped", reason: "NO_NATIVE_READER" | "WEB_NFC_NO_ISODEP" | "NFC_OFF" | "USER_SKIPPED" | "TIMEOUT" | "ACCESS_DENIED" | "NO_CHIP", signal?: AbortSignal): Promise<any>;
95
+ export interface FingerStatsOut {
96
+ sharpness: number;
97
+ glare: number;
98
+ ridge: number;
99
+ luma: number;
100
+ width_px: number;
101
+ }
102
+ export interface FingerUploadMeta {
103
+ positions: string[];
104
+ hand: "left" | "right";
105
+ boxes: Array<[number, number, number, number]>;
106
+ stats: FingerStatsOut[];
107
+ torch: {
108
+ supported: boolean;
109
+ response: number | null;
110
+ };
111
+ }
112
+ export declare function uploadFingerSignal(cfg: RpidClientConfig, upload: {
113
+ file: Blob;
114
+ crops: Blob[];
115
+ meta: FingerUploadMeta;
116
+ }, { capture, signal }?: {
117
+ capture?: Record<string, unknown> | null;
118
+ signal?: AbortSignal;
119
+ }): Promise<any>;
120
+ export declare function malformedFingerUpload(e: unknown): string | null;
121
+ export declare const uploadFinger: typeof uploadFingerSignal;
@@ -1,4 +1,4 @@
1
- export type CameraProfile = "default" | "document";
1
+ export type CameraProfile = "default" | "document" | "finger";
2
2
  export declare function cameraConstraints(facing: "environment" | "user", profile: CameraProfile): MediaTrackConstraints;
3
3
  export declare function parkCamera(stream: MediaStream, facing: "environment" | "user", profile: CameraProfile, graceMs?: number): void;
4
4
  export declare function openCamera(video: HTMLVideoElement, facing?: "environment" | "user", profile?: CameraProfile): Promise<MediaStream>;
@@ -1,2 +1,12 @@
1
1
  export declare function demoDocumentFrame(canvas: HTMLCanvasElement, side: "front" | "back", settled: number): void;
2
2
  export declare function demoFaceFrame(canvas: HTMLCanvasElement, settled: number): void;
3
+ export declare function demoFingerPixels(width: number, height: number, slots: ReadonlyArray<{
4
+ x: number;
5
+ y: number;
6
+ w: number;
7
+ h: number;
8
+ }>, settled: number): {
9
+ data: Uint8ClampedArray;
10
+ width: number;
11
+ height: number;
12
+ };
@@ -1,7 +1,8 @@
1
- export { uploadCapture, finalizeSession, probeDocument, uploadCaptureSignal, finalizeSessionSignal, probeDocumentSignal, errorCode, isAbort, rejectionOf, authenticityOf, apiHeaders, langHeaders, withLanguage, type RpidClientConfig, type MrzProbe, type MrzLayout, type CaptureUpload, type Rejection, type DocumentAuthenticity, } from "./api";
1
+ export { uploadCapture, finalizeSession, probeDocument, uploadCaptureSignal, finalizeSessionSignal, probeDocumentSignal, errorCode, isAbort, rejectionOf, authenticityOf, apiHeaders, langHeaders, withLanguage, uploadChipSignal, uploadChip, malformedFingerUpload, reportChipUnavailable, uploadFingerSignal, uploadFinger, chipFiles, concatBytes, base64Of, type RpidClientConfig, type MrzProbe, type MrzLayout, type CaptureUpload, type Rejection, type DocumentAuthenticity, type ChipFile, type ChipUploadMeta, type FingerUploadMeta, type FingerStatsOut, } from "./api";
2
2
  export { openCamera, parkCamera, stopStream, cameraConstraints, type CameraProfile } from "./camera";
3
+ export { torchSupported, setTorch, torchControl, type TorchControl } from "./torch";
3
4
  export { analyzeFrame, moireProbe, grabFrame, canvasToJpeg, thumbnailOf, readPixels, haptic, type Quality, type ProbeRegion, } from "./frames";
4
- export { demoDocumentFrame, demoFaceFrame } from "./demo";
5
+ export { demoDocumentFrame, demoFaceFrame, demoFingerPixels } from "./demo";
5
6
  export { createCaptureRun, frameLoop, nextFrame, type CaptureRun, type TickResult } from "./run";
6
7
  export { useCaptureRun, useLatest } from "./useCaptureRun";
7
8
  export { CaptureViewport, Guide, RetryButton, Telemetry } from "./chrome";
@@ -0,0 +1,14 @@
1
+ import type { CaptureRun } from "./run";
2
+ type TrackLike = Pick<MediaStreamTrack, "applyConstraints"> & {
3
+ getCapabilities?: () => unknown;
4
+ readyState?: string;
5
+ };
6
+ export declare function torchSupported(track: TrackLike | null | undefined): boolean;
7
+ export declare function setTorch(track: TrackLike | null | undefined, on: boolean): Promise<boolean>;
8
+ export interface TorchControl {
9
+ readonly supported: boolean;
10
+ readonly on: boolean;
11
+ set(on: boolean): Promise<boolean>;
12
+ }
13
+ export declare function torchControl(run: CaptureRun, track: TrackLike | null | undefined): TorchControl;
14
+ export {};
@@ -0,0 +1,21 @@
1
+ import { type Locale, type StringOverrides } from "../i18n";
2
+ import type { RpidClientConfig } from "../capture";
3
+ import type { SessionChip } from "../flows/types";
4
+ import type { ChipMrzKey, ChipReader } from "./provider";
5
+ import { type ChipOutcome } from "./useChipRead";
6
+ export interface ChipReadProps {
7
+ config: RpidClientConfig;
8
+ chip: SessionChip;
9
+ access?: ChipMrzKey | null;
10
+ can?: string;
11
+ reader?: ChipReader;
12
+ captureNonce?: string | null;
13
+ device?: "mobile" | "tablet" | "desktop";
14
+ onHandoff?: () => void;
15
+ locale?: Locale;
16
+ strings?: StringOverrides;
17
+ debug?: boolean;
18
+ onDone: (outcome: ChipOutcome) => void;
19
+ onRejected?: (reason: string, detail?: unknown) => void;
20
+ }
21
+ export declare function ChipRead(props: ChipReadProps): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { ChipReader } from "./provider";
2
+ export type ChipCapability = "native" | "web_nfc_presence_only" | "handoff" | "unavailable";
3
+ export type ChipUnavailableReason = "NO_NATIVE_READER" | "WEB_NFC_NO_ISODEP" | "NFC_OFF" | "USER_SKIPPED" | "TIMEOUT" | "ACCESS_DENIED" | "NO_CHIP";
4
+ export interface ChipDevice {
5
+ kind?: "mobile" | "tablet" | "desktop";
6
+ handoff?: boolean;
7
+ webNfc?: boolean;
8
+ }
9
+ export declare function webNfcAvailable(): boolean;
10
+ export declare function chipCapability(reader?: ChipReader | null, device?: ChipDevice): ChipCapability;
11
+ export declare function unavailableReason(cap: ChipCapability): ChipUnavailableReason;
@@ -0,0 +1,9 @@
1
+ import { type DeviceSignals, type TimelineSummary } from "../capture";
2
+ import type { ChipReadout } from "./provider";
3
+ export declare function chipEvidence(input: {
4
+ nonce: string | null | undefined;
5
+ readout: ChipReadout;
6
+ timeline: TimelineSummary;
7
+ device: DeviceSignals | null;
8
+ readAt?: Record<string, number>;
9
+ }): Promise<Record<string, unknown> | null>;
@@ -0,0 +1,42 @@
1
+ export interface ChipMrzKey {
2
+ documentNumber: string;
3
+ birthDate: string;
4
+ expiryDate: string;
5
+ }
6
+ export interface ChipReadProgress {
7
+ stage: "waiting" | "connected" | "auth" | "reading" | "done";
8
+ dg?: string;
9
+ fraction?: number;
10
+ }
11
+ export interface ChipReadInput {
12
+ mrz: {
13
+ documentNumber: string;
14
+ birthDate: string;
15
+ expiryDate: string;
16
+ } | null;
17
+ can?: string;
18
+ aaChallenge?: string;
19
+ dataGroups: string[];
20
+ signal: AbortSignal;
21
+ onProgress?(p: ChipReadProgress): void;
22
+ }
23
+ export interface ChipReadout {
24
+ access: "bac" | "pace";
25
+ dataGroups: Record<string, Uint8Array>;
26
+ sod: Uint8Array;
27
+ aaSignature?: Uint8Array;
28
+ timings?: Record<string, number>;
29
+ }
30
+ export type ChipReaderName = "native_android" | "native_ios" | "desktop_reader";
31
+ export interface ChipReader {
32
+ readonly name: ChipReaderName;
33
+ read(input: ChipReadInput): Promise<ChipReadout>;
34
+ }
35
+ export type ChipReadErrorCode = "ACCESS_DENIED" | "TIMEOUT" | "NFC_OFF" | "NO_CHIP" | "READ_FAILED";
36
+ export declare class ChipReadError extends Error {
37
+ readonly code: ChipReadErrorCode;
38
+ constructor(code: ChipReadErrorCode, message?: string);
39
+ }
40
+ export declare function normalizeChipError(e: unknown): ChipReadError | DOMException | Error;
41
+ export declare function toBytes(v: unknown): Uint8Array | null;
42
+ export declare function nativeChipReader(name: ChipReaderName, bridge: (input: ChipReadInput) => Promise<ChipReadout>): ChipReader;
@@ -0,0 +1,32 @@
1
+ import type { ChipReadProps } from "./ChipRead";
2
+ import { type ChipCapability, type ChipUnavailableReason } from "./capability";
3
+ import { type ChipReadErrorCode, type ChipReadProgress } from "./provider";
4
+ export type ChipPhase = "idle" | "waiting" | "reading" | "uploading" | "done" | "unavailable" | "error";
5
+ export declare const UNAVAILABLE_BEAT_MS = 600;
6
+ export type ChipOutcome = {
7
+ kind: "read";
8
+ access: "bac" | "pace";
9
+ dataGroups: string[];
10
+ activeAuth: boolean;
11
+ result: unknown;
12
+ } | {
13
+ kind: "unavailable" | "skipped";
14
+ reason: ChipUnavailableReason;
15
+ chipRequired: boolean;
16
+ result: unknown;
17
+ };
18
+ export declare function chipReadReason(code: ChipReadErrorCode): "CHIP_ACCESS_DENIED" | "CHIP_TIMEOUT" | "NFC_UNAVAILABLE" | "CHIP_READ_FAILED";
19
+ export declare function skipReason(code: ChipReadErrorCode | null): ChipUnavailableReason;
20
+ export declare function useChipRead(props: ChipReadProps): {
21
+ t: import("../i18n").Strings;
22
+ capability: ChipCapability;
23
+ phase: ChipPhase;
24
+ progress: ChipReadProgress | null;
25
+ readError: ChipReadErrorCode | null;
26
+ error: string | null;
27
+ errorDetail: unknown;
28
+ retriesLeft: number | null;
29
+ final: boolean;
30
+ retry: () => void;
31
+ skip: () => void;
32
+ };
@@ -0,0 +1,2 @@
1
+ export type NfcPresence = "tag_suspected" | "ndef_tag" | "none";
2
+ export declare function watchChipPresence(signal: AbortSignal, onHint: (p: NfcPresence) => void): Promise<boolean>;
@@ -42,6 +42,7 @@ export declare function MrzStatus({ stage, mrz, t }: {
42
42
  mrz: MrzProbe["mrz"] | null;
43
43
  t: Strings;
44
44
  }): import("react").JSX.Element | null;
45
+ export declare const AUTO_CONTINUE_S = 6;
45
46
  export declare function RetakePanel({ outcome, side, t, onRetake, onContinue, }: {
46
47
  outcome: Exclude<SideOutcome, {
47
48
  kind: "ok";
@@ -6,6 +6,7 @@ import type { FaceCaptureProps } from "../FaceCapture";
6
6
  import { PointsMotion } from "../document/track";
7
7
  import { type Framing } from "./runLiveness";
8
8
  export type FacePhase = "searching" | "locked" | "uploading" | "error";
9
+ export declare const FACE_CLIENT_RETRIES = 2;
9
10
  export declare function useFaceCapture(props: FaceCaptureProps): {
10
11
  t: import("../i18n").Strings;
11
12
  source: "camera" | "demo";
@@ -27,6 +28,11 @@ export declare function useFaceCapture(props: FaceCaptureProps): {
27
28
  };
28
29
  retry: () => void;
29
30
  retriesLeft: number | null;
31
+ retrying: {
32
+ code: string;
33
+ n: number;
34
+ total: number;
35
+ } | null;
30
36
  final: boolean;
31
37
  src: {
32
38
  w: number;
@@ -0,0 +1,14 @@
1
+ import type { Strings } from "../i18n";
2
+ import type { Slot } from "./detector";
3
+ import type { SlotState } from "./runFingerCapture";
4
+ export declare function FingerGuide({ src, slots, states, hold, t, done, }: {
5
+ src: {
6
+ w: number;
7
+ h: number;
8
+ };
9
+ slots: readonly Slot[];
10
+ states: readonly SlotState[];
11
+ hold: number;
12
+ t: Strings;
13
+ done?: boolean;
14
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,39 @@
1
+ import type { FingerPosition } from "../flows/types";
2
+ export interface FingerPixels {
3
+ data: ArrayLike<number>;
4
+ width: number;
5
+ height: number;
6
+ }
7
+ export interface Slot {
8
+ position: FingerPosition;
9
+ x: number;
10
+ y: number;
11
+ w: number;
12
+ h: number;
13
+ }
14
+ export interface FingerBox {
15
+ position: FingerPosition;
16
+ x: number;
17
+ y: number;
18
+ w: number;
19
+ h: number;
20
+ score: number;
21
+ }
22
+ export interface FingerDetector {
23
+ detect(px: FingerPixels, slots: Slot[]): FingerBox[] | Promise<FingerBox[]>;
24
+ }
25
+ export interface FingerGroup {
26
+ hand: "left" | "right";
27
+ positions: FingerPosition[];
28
+ }
29
+ export declare function fingerGroups(fingers: readonly FingerPosition[]): FingerGroup[];
30
+ export declare function fingerSlots(positions: readonly FingerPosition[], aspect: number): Slot[];
31
+ export declare function isSkin(r: number, g: number, b: number): boolean;
32
+ export declare const PRESENCE_MIN = 0.35;
33
+ export declare const silhouetteDetector: FingerDetector;
34
+ export declare function cropPixels(px: FingerPixels, b: {
35
+ x: number;
36
+ y: number;
37
+ w: number;
38
+ h: number;
39
+ }): FingerPixels | null;
@@ -0,0 +1,37 @@
1
+ import type { GuideKey } from "../i18n";
2
+ import type { FingerBox, FingerPixels, Slot } from "./detector";
3
+ export interface FingertipStats {
4
+ sharpness: number;
5
+ luma: number;
6
+ contrast: number;
7
+ glare: number;
8
+ ridge: number;
9
+ widthPx: number;
10
+ }
11
+ export type FingerGuideId = Extract<GuideKey, "no_hand" | "fingers_closer" | "fingers_back" | "fingers_together" | "hold_fingers_still" | "finger_glare" | "finger_blurry" | "show_left_hand" | "show_right_hand" | "too_dark" | "perfect">;
12
+ export interface FingerFloors {
13
+ widthPxMin: number;
14
+ slotFracMax: number;
15
+ glareMax: number;
16
+ lumaMin: number;
17
+ lumaMax: number;
18
+ ridgeMin: number;
19
+ sharpnessMin: number | null;
20
+ }
21
+ export declare const FINGER_FLOORS: FingerFloors;
22
+ export declare const RIDGE_W = 192;
23
+ export declare function ridgeScore(g: Float32Array, w: number, h: number): number;
24
+ export declare function fingertipStats(px: FingerPixels, box: {
25
+ x: number;
26
+ y: number;
27
+ w: number;
28
+ h: number;
29
+ }): FingertipStats;
30
+ export interface FingerReading {
31
+ slots: readonly Slot[];
32
+ boxes: readonly FingerBox[];
33
+ stats: ReadonlyArray<FingertipStats | null>;
34
+ hand?: "left" | "right";
35
+ }
36
+ export declare function fingertipPasses(st: FingertipStats | null, f?: FingerFloors): boolean;
37
+ export declare function fingerGate(r: FingerReading, f?: FingerFloors): FingerGuideId;
@@ -0,0 +1,77 @@
1
+ import type { FingerBox, FingerDetector, FingerGroup, FingerPixels } from "./detector";
2
+ import { type FingerFloors, type FingerGuideId, type FingertipStats } from "./qualityGate";
3
+ export declare const FINGER_TICK_MS = 90;
4
+ export declare const PRESENT_FRAMES = 3;
5
+ export declare const HOLD_FRAMES = 5;
6
+ export declare const STILL_MAX = 0.02;
7
+ export declare const FINGER_TIMEOUT_MS = 25000;
8
+ export declare const TORCH_SETTLE_MS = 350;
9
+ export interface FingerFrame<F> {
10
+ px: FingerPixels;
11
+ frame: F;
12
+ w: number;
13
+ h: number;
14
+ }
15
+ export interface FingerIo<F> {
16
+ alive(): boolean;
17
+ wait(ms: number): Promise<void>;
18
+ now(): number;
19
+ read(): Promise<FingerFrame<F> | null>;
20
+ detector: FingerDetector;
21
+ region(frame: F, box: {
22
+ x: number;
23
+ y: number;
24
+ w: number;
25
+ h: number;
26
+ }): FingerPixels | null;
27
+ keep?(frame: F): F;
28
+ encode(frame: F): Promise<Blob>;
29
+ crop(frame: F, box: {
30
+ x: number;
31
+ y: number;
32
+ w: number;
33
+ h: number;
34
+ }): Promise<Blob>;
35
+ torch?: {
36
+ supported: boolean;
37
+ on: boolean;
38
+ set(on: boolean): Promise<boolean>;
39
+ };
40
+ }
41
+ export type SlotState = "empty" | "found" | "good";
42
+ export interface FingerUi {
43
+ guide(k: FingerGuideId): void;
44
+ slots(states: SlotState[]): void;
45
+ hold(p: number): void;
46
+ stage(s: "searching" | "holding" | "torch" | "done"): void;
47
+ reading?(r: {
48
+ boxes: FingerBox[];
49
+ stats: Array<FingertipStats | null>;
50
+ guide: FingerGuideId;
51
+ }): void;
52
+ }
53
+ export interface FingerCaptureOutput {
54
+ file: Blob;
55
+ crops: Blob[];
56
+ boxes: Array<[number, number, number, number]>;
57
+ stats: FingertipStats[];
58
+ torch: {
59
+ supported: boolean;
60
+ response: number | null;
61
+ };
62
+ }
63
+ export type FingerRunResult = {
64
+ k: "captured";
65
+ out: FingerCaptureOutput;
66
+ } | {
67
+ k: "failed";
68
+ reason: "FINGER_NOT_FOUND" | "FINGER_QUALITY_LOW";
69
+ } | {
70
+ k: "aborted";
71
+ };
72
+ export declare function runFingerCapture<F>(group: FingerGroup, io: FingerIo<F>, ui: FingerUi, opts?: {
73
+ torch?: boolean;
74
+ floors?: FingerFloors;
75
+ timeoutMs?: number;
76
+ tickMs?: number;
77
+ }): Promise<FingerRunResult>;
@@ -0,0 +1,10 @@
1
+ import { type DeviceSignals, type TimelineSummary } from "../capture";
2
+ export declare function fingerEvidence(input: {
3
+ nonce: string | null | undefined;
4
+ file: Blob;
5
+ crops: readonly Blob[];
6
+ positions: readonly string[];
7
+ timeline: TimelineSummary;
8
+ device: DeviceSignals | null;
9
+ tMs?: number;
10
+ }): Promise<Record<string, unknown> | null>;
@@ -0,0 +1,31 @@
1
+ import { type RefObject } from "react";
2
+ import type { FingerCaptureProps } from "../FingerCapture";
3
+ import { type FingerGroup, type Slot } from "./detector";
4
+ import type { FingerGuideId } from "./qualityGate";
5
+ import { type SlotState } from "./runFingerCapture";
6
+ export type FingerPhase = "searching" | "holding" | "torch" | "uploading" | "done" | "error";
7
+ export declare function useFingerCapture(props: FingerCaptureProps): {
8
+ t: import("../i18n").Strings;
9
+ source: "camera" | "demo";
10
+ phase: FingerPhase;
11
+ guide: FingerGuideId;
12
+ slotStates: SlotState[];
13
+ hold: number;
14
+ group: FingerGroup;
15
+ groups: FingerGroup[];
16
+ groupAt: number;
17
+ slots: Slot[];
18
+ src: {
19
+ w: number;
20
+ h: number;
21
+ };
22
+ error: string | null;
23
+ errorDetail: unknown;
24
+ retriesLeft: number | null;
25
+ final: boolean;
26
+ torchOn: boolean;
27
+ tele: string;
28
+ retry: () => void;
29
+ videoRef: RefObject<HTMLVideoElement | null>;
30
+ canvasRef: RefObject<HTMLCanvasElement | null>;
31
+ };
@@ -10,11 +10,14 @@ export interface TenantInstructions {
10
10
  front?: StepInstructions;
11
11
  back?: StepInstructions;
12
12
  face?: StepInstructions;
13
+ chip?: StepInstructions;
14
+ finger?: StepInstructions;
13
15
  }
14
16
  export interface StepInstructions {
15
17
  enabled?: boolean;
16
18
  en?: IntroText;
17
19
  "es-419"?: IntroText;
20
+ unreadableHint?: boolean;
18
21
  }
19
22
  export interface TenantReasonText {
20
23
  title?: string;
@@ -26,6 +29,7 @@ export declare function normalizeInstructions(raw: unknown): TenantInstructions
26
29
  export declare function normalizeMessages(raw: unknown): TenantMessages | undefined;
27
30
  export declare function introEnabled(step: CaptureId, ins?: TenantInstructions | null): boolean;
28
31
  export declare function confirmEnabled(ins?: TenantInstructions | null): boolean;
32
+ export declare function unreadableHintEnabled(ins?: TenantInstructions | null): boolean;
29
33
  export declare function introFor(step: CaptureId, locale: Locale, t: Strings, ins?: TenantInstructions | null): Required<IntroText>;
30
34
  export declare function parseIntroBody(body: string): {
31
35
  paragraphs: string[];
@@ -3,4 +3,4 @@ export { SignInFlow } from "./SignInFlow";
3
3
  export { ReverificationFlow } from "./ReverificationFlow";
4
4
  export { IdentifyFlow } from "./IdentifyFlow";
5
5
  export { normalizeSession, captureNonceOf } from "./session";
6
- export type { EnrollmentFlowProps, SignInFlowProps, ReverificationFlowProps, IdentifyFlowProps, VerificationFlowProps, Purpose, IdentifyCandidate, DuplicateCandidate, ModelImprovementPrompt, ConsentChoice, OpenSessionContext, RpidSession, ApiSessionBody, SessionFlow, VerificationResult, VerificationAssessment, RpidFlowEvent, DocumentAuthenticity, ExtractionRecord, ExtractionField, Appearance, TenantInstructions, TenantMessages, SessionHandoff, HandoffOption, } from "./types";
6
+ export type { EnrollmentFlowProps, SignInFlowProps, ReverificationFlowProps, IdentifyFlowProps, VerificationFlowProps, Purpose, IdentifyCandidate, DuplicateCandidate, ModelImprovementPrompt, ConsentChoice, OpenSessionContext, RpidSession, ApiSessionBody, SessionFlow, VerificationResult, VerificationAssessment, RpidFlowEvent, DocumentAuthenticity, ExtractionRecord, ExtractionField, Appearance, TenantInstructions, TenantMessages, SessionHandoff, HandoffOption, SessionChip, SessionFinger, FingerPosition, StepId, } from "./types";
@@ -0,0 +1,27 @@
1
+ export declare const DEFAULT_SESSION_TTL_S = 900;
2
+ export declare const RENEW_MARGIN_MS = 60000;
3
+ export declare const MAX_SILENT_RENEWALS = 8;
4
+ export declare const MAX_IDLE_MS: number;
5
+ export type RenewReason = "expiring" | "resume" | "start" | "expired";
6
+ export type RenewOutcome = "renewed" | "failed" | "unsupported" | "aborted" | "skipped";
7
+ export interface SessionLife {
8
+ openedAt: number;
9
+ ttlMs: number;
10
+ silent: number;
11
+ touchedAt: number;
12
+ }
13
+ export declare function lifeOf(openedAt: number, expiresInS?: number, prev?: SessionLife | null, silent?: boolean): SessionLife;
14
+ export declare const expiresAtOf: (l: SessionLife) => number;
15
+ export declare const marginOf: (l: SessionLife) => number;
16
+ export declare const renewDueAt: (l: SessionLife) => number;
17
+ export declare const needsRenewal: (l: SessionLife, now: number) => boolean;
18
+ export declare const maySilentlyRenew: (l: SessionLife, now: number) => boolean;
19
+ export declare function useKeepFresh({ active, sessionId, life, renew, touch }: {
20
+ active: boolean;
21
+ sessionId: string;
22
+ life: {
23
+ readonly current: SessionLife | null;
24
+ };
25
+ renew: (why: RenewReason) => Promise<RenewOutcome>;
26
+ touch: () => void;
27
+ }): void;
@@ -1,4 +1,8 @@
1
- import type { RpidSession, SessionFlow } from "./types";
1
+ import type { FingerPosition, RpidSession, SessionChip, SessionFinger, SessionFlow, StepId } from "./types";
2
+ export declare const FINGER_POSITIONS: readonly FingerPosition[];
3
+ export declare function normalizeSteps(raw: unknown): StepId[] | undefined;
4
+ export declare function normalizeChip(raw: unknown): SessionChip | undefined;
5
+ export declare function normalizeFinger(raw: unknown): SessionFinger | undefined;
2
6
  export declare function normalizeFlow(raw: unknown): SessionFlow | undefined;
3
7
  export declare function normalizeSession(raw: unknown): RpidSession;
4
8
  export declare const captureNonceOf: (s: RpidSession | null | undefined) => string | null;