@baas-id/react 0.3.1 → 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.
- package/README.md +27 -3
- package/dist/esm/baas-id-react.css +1 -1
- package/dist/esm/chunks/ContinueFlow-BzKnkzHf.js +11597 -0
- package/dist/esm/chunks/provider-DqpgUBfH.js +87 -0
- package/dist/esm/continue.js +11 -7
- package/dist/esm/index.js +156 -119
- package/dist/esm/native.js +91 -0
- package/dist/esm/preview.js +220 -181
- package/dist/esm/workers/{detector.worker-DrerkwUk.js → detector.worker-Bpzz3rZ5.js} +1191 -1191
- package/dist/types/continue.d.ts +3 -0
- package/dist/types/index.d.ts +10 -1
- package/dist/types/native.d.ts +38 -0
- package/dist/types/react/DocumentCapture.d.ts +1 -0
- package/dist/types/react/FingerCapture.d.ts +20 -0
- package/dist/types/react/capture/api.d.ts +53 -0
- package/dist/types/react/capture/camera.d.ts +1 -1
- package/dist/types/react/capture/demo.d.ts +10 -0
- package/dist/types/react/capture/index.d.ts +3 -2
- package/dist/types/react/capture/keyframes.d.ts +8 -1
- package/dist/types/react/capture/torch.d.ts +14 -0
- package/dist/types/react/chip/ChipRead.d.ts +21 -0
- package/dist/types/react/chip/capability.d.ts +11 -0
- package/dist/types/react/chip/evidence.d.ts +9 -0
- package/dist/types/react/chip/provider.d.ts +42 -0
- package/dist/types/react/chip/useChipRead.d.ts +32 -0
- package/dist/types/react/chip/webNfcPresence.d.ts +2 -0
- package/dist/types/react/document/DocumentParts.d.ts +1 -0
- package/dist/types/react/document/cornerOrder.d.ts +1 -0
- package/dist/types/react/document/follow.d.ts +26 -0
- package/dist/types/react/document/resolution.d.ts +1 -0
- package/dist/types/react/document/review.d.ts +1 -1
- package/dist/types/react/document/sideCheck.d.ts +1 -0
- package/dist/types/react/document/steady.d.ts +0 -6
- package/dist/types/react/document/upright.d.ts +1 -0
- package/dist/types/react/document/useDocumentCapture.d.ts +23 -2
- package/dist/types/react/face/bestFrame.d.ts +17 -0
- package/dist/types/react/face/faceView.d.ts +3 -0
- package/dist/types/react/face/runLiveness.d.ts +2 -0
- package/dist/types/react/face/useFaceCapture.d.ts +6 -0
- package/dist/types/react/finger/FingerGuide.d.ts +14 -0
- package/dist/types/react/finger/detector.d.ts +39 -0
- package/dist/types/react/finger/qualityGate.d.ts +37 -0
- package/dist/types/react/finger/runFingerCapture.d.ts +77 -0
- package/dist/types/react/finger/upload.d.ts +10 -0
- package/dist/types/react/finger/useFingerCapture.d.ts +31 -0
- package/dist/types/react/flows/FlowShell.d.ts +2 -0
- package/dist/types/react/flows/experience.d.ts +4 -0
- package/dist/types/react/flows/index.d.ts +1 -1
- package/dist/types/react/flows/renewal.d.ts +27 -0
- package/dist/types/react/flows/session.d.ts +5 -1
- package/dist/types/react/flows/state.d.ts +34 -2
- package/dist/types/react/flows/types.d.ts +58 -0
- package/dist/types/react/flows/useFlowSession.d.ts +12 -2
- package/dist/types/react/handoff/ContinueFlow.d.ts +15 -2
- package/dist/types/react/handoff/ContinueOnPhone.d.ts +19 -1
- package/dist/types/react/handoff/api.d.ts +8 -2
- package/dist/types/react/handoff/phoneLink.d.ts +2 -1
- package/dist/types/react/i18n/types.d.ts +45 -3
- package/dist/types/react/preview/FlowPreview.d.ts +1 -0
- package/dist/types/react/telemetry/bus.d.ts +1 -1
- package/dist/types/react/theme/scheme.d.ts +17 -0
- package/dist/types/react/version.d.ts +1 -1
- package/dist/types/react/vision/corners.d.ts +1 -1
- package/dist/types/react/vision/face.d.ts +13 -0
- package/dist/types/react/vision/quality.d.ts +5 -2
- package/dist/types/react/vision/refine.d.ts +71 -0
- package/dist/types/react/vision/resample.d.ts +7 -0
- package/dist/types/react/vision/tinyDetector.d.ts +1 -0
- package/dist/types/react/vision/types.d.ts +3 -1
- package/package.json +6 -1
- package/dist/esm/chunks/ContinueFlow-mqBIxnlp.js +0 -9327
- package/dist/types/react/document/flow.d.ts +0 -52
- package/dist/types/react/document/latch.d.ts +0 -25
package/dist/types/continue.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { ContinueFlow, readHandoffCode, type ContinueFlowProps } from "./react/handoff/ContinueFlow";
|
|
2
2
|
export { DEFAULT_MODELS_URL, MODELS_VERSION } from "./react/vision/modelsCdn";
|
|
3
3
|
export { getStrings, LOCALES, type Locale, type Strings, type StringOverrides, type Formality } from "./react/i18n";
|
|
4
|
+
export { nativeChipReader, ChipReadError, type ChipReader, type ChipReadout, type ChipReadInput, type ChipReadProgress, type ChipReaderName, } from "./react/chip/provider";
|
|
5
|
+
export { chipCapability, type ChipCapability } from "./react/chip/capability";
|
|
6
|
+
export type { FingerDetector, FingerBox } from "./react/finger/detector";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
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, type SessionChip, type SessionFinger, type FingerPosition, type StepId, } from "./react/flows";
|
|
2
2
|
export type { ColorScheme } from "./react/theme/scheme";
|
|
3
3
|
export { ContinueOnPhone, HandoffPanel, HandoffView, type ContinueOnPhoneProps, type HandoffMode, type HandoffCopy, } from "./react/handoff/ContinueOnPhone";
|
|
4
4
|
export { ContinueFlow, readHandoffCode, type ContinueFlowProps } from "./react/handoff/ContinueFlow";
|
|
@@ -10,6 +10,15 @@ export { SDK_VERSION } from "./react/version";
|
|
|
10
10
|
export { DocumentCapture, type DocumentCaptureProps, type SideRetake } from "./react/DocumentCapture";
|
|
11
11
|
export { sideOutcomeOf, type SideOutcome } from "./react/document/sideCheck";
|
|
12
12
|
export { FaceCapture, type FaceCaptureProps } from "./react/FaceCapture";
|
|
13
|
+
export { ChipRead, type ChipReadProps } from "./react/chip/ChipRead";
|
|
14
|
+
export type { ChipOutcome } from "./react/chip/useChipRead";
|
|
15
|
+
export { nativeChipReader, ChipReadError, normalizeChipError, type ChipReader, type ChipReadout, type ChipReadInput, type ChipReadProgress, type ChipReaderName, type ChipReadErrorCode, type ChipMrzKey, } from "./react/chip/provider";
|
|
16
|
+
export { chipCapability, unavailableReason, webNfcAvailable, type ChipCapability, type ChipUnavailableReason, type ChipDevice, } from "./react/chip/capability";
|
|
17
|
+
export { watchChipPresence, type NfcPresence } from "./react/chip/webNfcPresence";
|
|
18
|
+
export { FingerCapture, type FingerCaptureProps } from "./react/FingerCapture";
|
|
19
|
+
export { silhouetteDetector, fingerSlots, fingerGroups, type FingerDetector, type FingerBox, type FingerPixels, type FingerGroup, type Slot as FingerSlot, } from "./react/finger/detector";
|
|
20
|
+
export { fingertipStats, fingerGate, FINGER_FLOORS, type FingertipStats, type FingerFloors, type FingerGuideId, } from "./react/finger/qualityGate";
|
|
21
|
+
export { uploadChip, reportChipUnavailable, uploadFinger, torchSupported, setTorch, type ChipUploadMeta, type FingerUploadMeta, } from "./react/capture";
|
|
13
22
|
export { selfieQualityIssue, faceCropStats, floorsFrom, SELFIE_QUALITY_DEFAULTS, type SelfieQualityFloors, type SelfieQualityReading, type QualityIssue, } from "./react/face/qualityGate";
|
|
14
23
|
export { finalizeSession, uploadCapture, probeDocument, type Quality, type RpidClientConfig, type MrzProbe, } from "./react/capture";
|
|
15
24
|
export { webAttestation, nativeAttestation, requestHash, type AttestationProvider, type AttestationClaim, type AttestationName, type NativeMint, } from "./react/capture";
|
|
@@ -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";
|
|
@@ -11,9 +11,16 @@ export declare function keyframeSize(w: number, h: number, maxSide?: number): {
|
|
|
11
11
|
h: number;
|
|
12
12
|
};
|
|
13
13
|
export declare function admit(tags: readonly string[], tag: string, max?: number): boolean;
|
|
14
|
+
type Frame = HTMLVideoElement | HTMLCanvasElement;
|
|
14
15
|
export declare class KeyframeRecorder {
|
|
15
16
|
private pending;
|
|
16
17
|
private tags;
|
|
17
|
-
|
|
18
|
+
private best;
|
|
19
|
+
private copy;
|
|
20
|
+
private encode;
|
|
21
|
+
offer(src: Frame | null, tag: string, tMs: number, score: number): void;
|
|
22
|
+
commit(tag: string, fallback: Frame | null, tMs: number): void;
|
|
23
|
+
grab(frame: Frame | null, tag: string, tMs: number): void;
|
|
18
24
|
collect(): Promise<Keyframe[]>;
|
|
19
25
|
}
|
|
26
|
+
export {};
|
|
@@ -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
|
+
};
|
|
@@ -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";
|
|
@@ -31,6 +31,7 @@ export declare class CornerOrder {
|
|
|
31
31
|
read(raw: Quad, fromModel: boolean, orient?: readonly number[] | null): Quad;
|
|
32
32
|
private canonLock;
|
|
33
33
|
rotationFor(stable: Quad): number;
|
|
34
|
+
headRotation(): number | null;
|
|
34
35
|
settle(held: Quad, k: number): number;
|
|
35
36
|
flip(stable: Quad): number;
|
|
36
37
|
orientQuad(q: Quad): Quad;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Quad } from "./overlay";
|
|
2
|
+
export declare const FOLLOW_TAU_MS = 40;
|
|
3
|
+
export declare const HOLD_MS = 350;
|
|
4
|
+
export declare const JUMP = 0.25;
|
|
5
|
+
export declare const TOUCH_SHIFT = 0.03;
|
|
6
|
+
export declare const TOUCH_SCALE = 1.1;
|
|
7
|
+
export declare const TOUCH_MAX_MS = 500;
|
|
8
|
+
export declare class CardFollower {
|
|
9
|
+
private meas;
|
|
10
|
+
private measAt;
|
|
11
|
+
private shown;
|
|
12
|
+
private shownAt;
|
|
13
|
+
private gap;
|
|
14
|
+
measure(q: Quad, t: number): void;
|
|
15
|
+
private lastReal;
|
|
16
|
+
private hold;
|
|
17
|
+
touch(box: {
|
|
18
|
+
left: number;
|
|
19
|
+
top: number;
|
|
20
|
+
right: number;
|
|
21
|
+
bottom: number;
|
|
22
|
+
}, t: number): boolean;
|
|
23
|
+
last(t: number, maxAge?: number): Quad | null;
|
|
24
|
+
at(now: number): Quad | null;
|
|
25
|
+
reset(): void;
|
|
26
|
+
}
|
|
@@ -7,6 +7,7 @@ export interface Box {
|
|
|
7
7
|
export declare const WORK_LONG_SIDE = 1280;
|
|
8
8
|
export declare const UPLOAD_LONG_MAX = 1600;
|
|
9
9
|
export declare const UPLOAD_MARGIN = 0.03;
|
|
10
|
+
export declare const RECT_MARGIN = 0.015;
|
|
10
11
|
export declare const UPLOAD_JPEG_QUALITY = 0.9;
|
|
11
12
|
export declare const EXTRA_JPEG_QUALITY = 0.85;
|
|
12
13
|
export declare const EXTRA_JPEG_QUALITY_LOW = 0.75;
|
|
@@ -69,7 +69,7 @@ export interface CardInset {
|
|
|
69
69
|
x: number;
|
|
70
70
|
y: number;
|
|
71
71
|
}
|
|
72
|
-
export declare function cardInset(margin: number,
|
|
72
|
+
export declare function cardInset(margin: number, _aspect?: number): CardInset;
|
|
73
73
|
export interface ReviewView {
|
|
74
74
|
image: string;
|
|
75
75
|
aspect: number;
|
|
@@ -17,6 +17,7 @@ export type SideOutcome = {
|
|
|
17
17
|
suggest: "continue" | "retake";
|
|
18
18
|
} & SideCopy);
|
|
19
19
|
export declare function sideOutcomeOf(side: Side, res: unknown): SideOutcome;
|
|
20
|
+
export declare const QUALITY_RETAKE_REASONS: readonly string[];
|
|
20
21
|
export declare function fallbackCopy(o: Exclude<SideOutcome, {
|
|
21
22
|
kind: "ok";
|
|
22
23
|
}>, side: Side, t: Strings): {
|
|
@@ -3,3 +3,4 @@ export type Turn = 0 | 90 | 180 | 270;
|
|
|
3
3
|
export declare function rotateCanvas(src: HTMLCanvasElement, deg: Turn): HTMLCanvasElement;
|
|
4
4
|
export declare function uprightFace(f: FaceDetection): boolean;
|
|
5
5
|
export declare function portraitTurn(crop: HTMLCanvasElement, faces: (c: HTMLCanvasElement) => Promise<FaceDetection[]>): Promise<Turn | null>;
|
|
6
|
+
export declare function uprightAt(crop: HTMLCanvasElement, faces: (c: HTMLCanvasElement) => Promise<FaceDetection[]>, deg: Turn): Promise<boolean>;
|
|
@@ -4,7 +4,7 @@ import { type Chip, type Guidance, type Phase } from "./gate";
|
|
|
4
4
|
import { type MrzStage } from "./mrz";
|
|
5
5
|
import { type Advisory } from "./advisory";
|
|
6
6
|
import { type Box, type Quad } from "./overlay";
|
|
7
|
-
import {
|
|
7
|
+
import type { QuadSource } from "./track";
|
|
8
8
|
import { type ReviewView } from "./review";
|
|
9
9
|
export interface SnapshotFrom {
|
|
10
10
|
l: number;
|
|
@@ -20,13 +20,34 @@ export interface Snapshot {
|
|
|
20
20
|
export declare const LOCK_MS = 520;
|
|
21
21
|
export declare const REVIEW_MS = 2600;
|
|
22
22
|
export declare const CROP_TURN_MIN = 1;
|
|
23
|
-
export declare const OUTLINE_BETA = 0.015;
|
|
24
23
|
export declare const FLIP_MANUAL_MS = 15000;
|
|
24
|
+
export declare const TURN_HEAD_MIN = 0.6;
|
|
25
|
+
export declare const CONFIRM_MS = 700;
|
|
26
|
+
export declare const CONFIRM_SHAPE = 0.015;
|
|
27
|
+
export declare function confirmed(q: Quad, prev: {
|
|
28
|
+
q: Quad;
|
|
29
|
+
t: number;
|
|
30
|
+
} | null, t: number): boolean;
|
|
25
31
|
export declare function cutUpload(full: HTMLCanvasElement, b: Box): HTMLCanvasElement;
|
|
32
|
+
export declare function poseShape(c: {
|
|
33
|
+
quad: unknown;
|
|
34
|
+
aspect: number;
|
|
35
|
+
tilt: number;
|
|
36
|
+
} | null | undefined): {
|
|
37
|
+
aspect: number;
|
|
38
|
+
tilt: number;
|
|
39
|
+
} | null;
|
|
40
|
+
export declare function heldPortrait(q: Quad): boolean;
|
|
26
41
|
export interface UploadCandidate {
|
|
27
42
|
canvas: HTMLCanvasElement;
|
|
28
43
|
quad: Quad | null;
|
|
29
44
|
}
|
|
45
|
+
export declare const AGREE_MAX = 0.006;
|
|
46
|
+
export declare function confirmCorners(c: UploadCandidate, cam: {
|
|
47
|
+
focal: number;
|
|
48
|
+
cx: number;
|
|
49
|
+
cy: number;
|
|
50
|
+
}): UploadCandidate;
|
|
30
51
|
export declare function cutCard(full: HTMLCanvasElement, b: Box, quad?: Quad | null): UploadCandidate;
|
|
31
52
|
export declare function useDocumentCapture(props: DocumentCaptureProps): {
|
|
32
53
|
t: import("../i18n").Strings;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FaceSignals } from "../liveness";
|
|
2
|
+
export declare const PROBE_YAW_MAX = 0.15;
|
|
3
|
+
export declare const PROBE_YAW_CONFIDENCE_MIN = 0.45;
|
|
4
|
+
export declare const PROBE_FILL_MIN = 0.6;
|
|
5
|
+
export declare const PROBE_SHARP_REF = 300;
|
|
6
|
+
export interface ProbeStats {
|
|
7
|
+
sharpness: number;
|
|
8
|
+
luma: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function probeScore(sig: FaceSignals, stats: ProbeStats | null): number;
|
|
11
|
+
export declare class BestFrame {
|
|
12
|
+
private canvas;
|
|
13
|
+
score: number;
|
|
14
|
+
offered: number;
|
|
15
|
+
offer(frame: HTMLCanvasElement | null, score: number): boolean;
|
|
16
|
+
get frame(): HTMLCanvasElement | null;
|
|
17
|
+
}
|
|
@@ -6,6 +6,7 @@ export interface Ellipse {
|
|
|
6
6
|
rx: number;
|
|
7
7
|
ry: number;
|
|
8
8
|
}
|
|
9
|
+
export declare const FACE_LANDSCAPE_AR: number;
|
|
9
10
|
export declare const faceViewMap: (srcW: number, srcH: number, viewW: number, viewH: number) => ViewMap;
|
|
10
11
|
export declare function ovalToView(o: Ellipse, m: ViewMap): Ellipse;
|
|
11
12
|
export declare function trackPoints(g: FaceGeometry): Pt[];
|
|
@@ -16,6 +17,8 @@ export interface FaceMark {
|
|
|
16
17
|
mouth?: Pt;
|
|
17
18
|
ears?: [Pt, Pt];
|
|
18
19
|
}
|
|
20
|
+
export declare const FACE_W_H_MIN = 0.72;
|
|
21
|
+
export declare const FACE_W_H_MAX = 0.8;
|
|
19
22
|
export declare function faceMarkToView(pts: readonly Pt[], srcW: number, srcH: number, m: ViewMap): FaceMark | null;
|
|
20
23
|
export declare const ovalFill: (faceW: number, oval: Ellipse) => number;
|
|
21
24
|
export declare function ellipsePath(e: Ellipse): string;
|
|
@@ -13,6 +13,7 @@ export interface LivenessIo {
|
|
|
13
13
|
strings(): Strings;
|
|
14
14
|
now(): number;
|
|
15
15
|
keyframe?(tag: string): void;
|
|
16
|
+
keyframeOffer?(tag: string, score: number): void;
|
|
16
17
|
}
|
|
17
18
|
export interface LivenessUi {
|
|
18
19
|
locked(): void;
|
|
@@ -34,4 +35,5 @@ export type LivenessResult = {
|
|
|
34
35
|
} | {
|
|
35
36
|
k: "aborted";
|
|
36
37
|
};
|
|
38
|
+
export declare function movementScore(kind: ChallengeKind, sig: FaceSignals): number;
|
|
37
39
|
export declare function runLiveness(script: ChallengeKind[], tracker: LivenessTracker, io: LivenessIo, ui: LivenessUi): Promise<LivenessResult>;
|
|
@@ -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;
|