@finclusionaibuild/liveness-sdk 1.0.0
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/LICENSE +21 -0
- package/README.md +843 -0
- package/dist/index.cjs.js +85288 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.esm.js +85256 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/styles.css +7224 -0
- package/package.json +75 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Liveness SDK Types
|
|
6
|
+
*/
|
|
7
|
+
interface LivenessSession {
|
|
8
|
+
sessionId: string;
|
|
9
|
+
awsAccessKeyId: string;
|
|
10
|
+
awsSecretAccessKey: string;
|
|
11
|
+
awsSessionToken?: string;
|
|
12
|
+
awsRegion: string;
|
|
13
|
+
}
|
|
14
|
+
interface LivenessConfig {
|
|
15
|
+
apiBaseUrl: string;
|
|
16
|
+
getAuthToken: () => string | null;
|
|
17
|
+
endpoints?: {
|
|
18
|
+
createSession?: string;
|
|
19
|
+
verify?: string;
|
|
20
|
+
compareWithUser?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
interface LivenessVerificationResponse {
|
|
24
|
+
confidence: number;
|
|
25
|
+
image?: string;
|
|
26
|
+
success?: boolean;
|
|
27
|
+
message?: string;
|
|
28
|
+
}
|
|
29
|
+
interface FaceMatchResponse {
|
|
30
|
+
isMatch: boolean;
|
|
31
|
+
confidence: number;
|
|
32
|
+
details: string;
|
|
33
|
+
}
|
|
34
|
+
interface LivenessError {
|
|
35
|
+
state?: string;
|
|
36
|
+
error?: {
|
|
37
|
+
message?: string;
|
|
38
|
+
};
|
|
39
|
+
response?: {
|
|
40
|
+
status?: number;
|
|
41
|
+
data?: {
|
|
42
|
+
statusCode?: number;
|
|
43
|
+
message?: string;
|
|
44
|
+
error?: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
message?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface LivenessDetectorProps {
|
|
51
|
+
config: LivenessConfig;
|
|
52
|
+
token?: string | null;
|
|
53
|
+
gotoNext: () => void;
|
|
54
|
+
logoUrl?: string;
|
|
55
|
+
instructionText?: string;
|
|
56
|
+
}
|
|
57
|
+
declare const LivenessDetector: React.FC<LivenessDetectorProps>;
|
|
58
|
+
|
|
59
|
+
interface ExternalLivenessProps {
|
|
60
|
+
config: LivenessConfig;
|
|
61
|
+
token?: string | null;
|
|
62
|
+
gotoNext: () => void;
|
|
63
|
+
region?: string;
|
|
64
|
+
logoUrl?: string;
|
|
65
|
+
instructionText?: string;
|
|
66
|
+
}
|
|
67
|
+
declare const ExternalLiveness: React.FC<ExternalLivenessProps>;
|
|
68
|
+
|
|
69
|
+
interface PaymentLivenessProps {
|
|
70
|
+
config: LivenessConfig;
|
|
71
|
+
token?: string | null;
|
|
72
|
+
gotoNext: () => void;
|
|
73
|
+
handleClose?: () => void;
|
|
74
|
+
logoUrl?: string;
|
|
75
|
+
instructionText?: string;
|
|
76
|
+
onSendOtp?: () => Promise<void>;
|
|
77
|
+
}
|
|
78
|
+
declare const PaymentLiveness: React.FC<PaymentLivenessProps>;
|
|
79
|
+
|
|
80
|
+
interface FaceMatchResultProps {
|
|
81
|
+
result: FaceMatchResponse;
|
|
82
|
+
onNext: () => void;
|
|
83
|
+
onRetry: () => void;
|
|
84
|
+
}
|
|
85
|
+
declare const FaceMatchResult: React.FC<FaceMatchResultProps>;
|
|
86
|
+
|
|
87
|
+
interface LoadingSpinnerProps {
|
|
88
|
+
size?: number;
|
|
89
|
+
message?: string;
|
|
90
|
+
}
|
|
91
|
+
declare const LoadingSpinner: React.FC<LoadingSpinnerProps>;
|
|
92
|
+
|
|
93
|
+
interface ErrorCardProps {
|
|
94
|
+
error: LivenessError | null;
|
|
95
|
+
retryAnalysis: () => void;
|
|
96
|
+
}
|
|
97
|
+
declare const ErrorCard: React.FC<ErrorCardProps>;
|
|
98
|
+
|
|
99
|
+
interface ErrorBlockProps {
|
|
100
|
+
error: LivenessError | null;
|
|
101
|
+
retryAnalysis: () => void;
|
|
102
|
+
}
|
|
103
|
+
declare const ErrorBlock: React.FC<ErrorBlockProps>;
|
|
104
|
+
|
|
105
|
+
interface AnalysisResultProps {
|
|
106
|
+
confidence: number;
|
|
107
|
+
retryAnalysis: () => void;
|
|
108
|
+
}
|
|
109
|
+
declare const AnalysisResult: React.FC<AnalysisResultProps>;
|
|
110
|
+
|
|
111
|
+
interface ProcessedImageProps {
|
|
112
|
+
image: string;
|
|
113
|
+
confidence: number;
|
|
114
|
+
gotoNext: () => void;
|
|
115
|
+
buttonText?: string;
|
|
116
|
+
}
|
|
117
|
+
declare const ProcessedImage: React.FC<ProcessedImageProps>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* API Client for Liveness SDK
|
|
121
|
+
* Handles all API calls to the liveness endpoints
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
declare class ApiError extends Error {
|
|
125
|
+
statusCode: number;
|
|
126
|
+
data?: any | undefined;
|
|
127
|
+
constructor(statusCode: number, message: string, data?: any | undefined);
|
|
128
|
+
}
|
|
129
|
+
declare class LivenessAPIClient {
|
|
130
|
+
private baseUrl;
|
|
131
|
+
private getToken;
|
|
132
|
+
constructor(config: LivenessConfig);
|
|
133
|
+
private getAuthHeaders;
|
|
134
|
+
private handleResponse;
|
|
135
|
+
/**
|
|
136
|
+
* Create a new liveness session
|
|
137
|
+
* GET /kyc/liveliness
|
|
138
|
+
*/
|
|
139
|
+
createSession(endpoint?: string): Promise<LivenessSession>;
|
|
140
|
+
/**
|
|
141
|
+
* Verify liveness session and get results
|
|
142
|
+
* GET /kyc/liveliness/{sessionId}
|
|
143
|
+
*/
|
|
144
|
+
verify(sessionId: string, endpoint?: string): Promise<LivenessVerificationResponse>;
|
|
145
|
+
/**
|
|
146
|
+
* Compare liveness result with user profile
|
|
147
|
+
* GET /kyc/liveliness/{sessionId}/compare-with-user
|
|
148
|
+
*/
|
|
149
|
+
compareWithUser(sessionId: string, endpoint?: string): Promise<FaceMatchResponse>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
declare class LivenessService {
|
|
153
|
+
private apiClient;
|
|
154
|
+
private config;
|
|
155
|
+
constructor(config: LivenessConfig);
|
|
156
|
+
/**
|
|
157
|
+
* Get API client instance
|
|
158
|
+
*/
|
|
159
|
+
getApiClient(): LivenessAPIClient;
|
|
160
|
+
/**
|
|
161
|
+
* Hook to fetch liveness session
|
|
162
|
+
* Uses React Query for caching and state management
|
|
163
|
+
*/
|
|
164
|
+
useLivenessSession(token?: string | null): _tanstack_react_query.UseQueryResult<LivenessSession, Error>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Default ID Certify logo embedded as URL-encoded data URL
|
|
169
|
+
* This logo is automatically used by components if no logoUrl prop is provided
|
|
170
|
+
*/
|
|
171
|
+
declare const DEFAULT_ID_CERTIFY_LOGO: string;
|
|
172
|
+
|
|
173
|
+
export { AnalysisResult, ApiError, DEFAULT_ID_CERTIFY_LOGO, ErrorBlock, ErrorCard, ExternalLiveness, FaceMatchResult, LivenessAPIClient, LivenessDetector, LivenessService, LoadingSpinner, PaymentLiveness, ProcessedImage };
|
|
174
|
+
export type { FaceMatchResponse, LivenessConfig, LivenessError, LivenessSession, LivenessVerificationResponse };
|