@finos_sdk/sdk-ekyc 1.3.2 → 1.3.4
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/android/build.gradle +1 -1
- package/android/src/main/java/finos/sdk/ekyc/EKYCModule.kt +281 -96
- package/dist/EKYCModule.d.ts +17 -2
- package/dist/EKYCModule.js +41 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.js +8 -1
- package/dist/package.json +1 -1
- package/dist/src/modules/FinosEKYCModule.d.ts +13 -5
- package/dist/src/modules/FinosEKYCModule.js +10 -8
- package/dist/src/modules/FinosESignModule.d.ts +13 -1
- package/dist/src/modules/FinosESignModule.js +23 -4
- package/dist/src/types/ekycFaceType.d.ts +7 -0
- package/dist/src/types/ekycFlowType.d.ts +17 -0
- package/dist/src/types/ekycFlowType.js +28 -0
- package/dist/src/types/ekycLivenessType.d.ts +16 -0
- package/dist/src/types/ekycLivenessType.js +32 -1
- package/dist/src/types/ekycType.d.ts +30 -0
- package/package.json +1 -1
- package/src/modules/FinosEKYCModule.ts +23 -10
- package/src/modules/FinosESignModule.ts +32 -5
- package/src/modules/README.md +1 -1
- package/src/types/ekycFaceType.ts +7 -0
- package/src/types/ekycFlowType.ts +25 -0
- package/src/types/ekycLivenessType.ts +33 -1
- package/src/types/ekycType.ts +31 -0
package/dist/index.d.ts
CHANGED
|
@@ -5,13 +5,14 @@ export default sdkEKYC;
|
|
|
5
5
|
export { sdkEKYC, SDKeKYC };
|
|
6
6
|
export { FinosEKYC, FinosEKYCModule };
|
|
7
7
|
export { FinosESign, FinosESignModule };
|
|
8
|
+
export { SDKFlowType, SDK_FLOW_OPTIONS, flowToStrings } from './src/types/ekycFlowType';
|
|
8
9
|
export type { NfcConfig, NFCData, NfcInfo } from './src/types/ekycNFCType';
|
|
9
10
|
export type { C06Config } from './src/types/ekycC06Type';
|
|
10
11
|
export type { OcrConfig } from './src/types/ekycOCRType';
|
|
11
12
|
export type { LivenessConfig } from './src/types/ekycLivenessType';
|
|
12
|
-
export { SDKFaceDetectStatus } from './src/types/ekycLivenessType';
|
|
13
|
+
export { SDKFaceDetectStatus, SDK_LIVENESS_ACTIONS, customActionsToStrings } from './src/types/ekycLivenessType';
|
|
13
14
|
export type { FaceServiceConfig } from './src/types/ekycFaceType';
|
|
14
|
-
export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent } from './src/types/ekycType';
|
|
15
|
+
export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, StartEkycUIResult } from './src/types/ekycType';
|
|
15
16
|
export type { NfcError } from './src/types/ekycNFCType';
|
|
16
17
|
export type { SDKTransactionResponse } from './src/types/ekycTransactionType';
|
|
17
18
|
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from './src/types/ekycSmsOtpType';
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.SDK_NAME = exports.SDK_VERSION = exports.parseNfcResponse = exports.SDKFaceDetectStatus = exports.FinosESignModule = exports.FinosESign = exports.FinosEKYCModule = exports.FinosEKYC = exports.SDKeKYC = exports.sdkEKYC = void 0;
|
|
26
|
+
exports.SDK_NAME = exports.SDK_VERSION = exports.parseNfcResponse = exports.customActionsToStrings = exports.SDK_LIVENESS_ACTIONS = exports.SDKFaceDetectStatus = exports.flowToStrings = exports.SDK_FLOW_OPTIONS = exports.SDKFlowType = exports.FinosESignModule = exports.FinosESign = exports.FinosEKYCModule = exports.FinosEKYC = exports.SDKeKYC = exports.sdkEKYC = void 0;
|
|
27
27
|
const EKYCModule_1 = __importStar(require("./EKYCModule"));
|
|
28
28
|
exports.sdkEKYC = EKYCModule_1.default;
|
|
29
29
|
Object.defineProperty(exports, "SDKeKYC", { enumerable: true, get: function () { return EKYCModule_1.SDKeKYC; } });
|
|
@@ -38,8 +38,15 @@ Object.defineProperty(exports, "FinosESignModule", { enumerable: true, get: func
|
|
|
38
38
|
console.log('✅ SDK modules loaded successfully');
|
|
39
39
|
// Export main SDK instance and class (legacy)
|
|
40
40
|
exports.default = EKYCModule_1.default;
|
|
41
|
+
// Flow type enum – bên sử dụng truyền enum vào startEkycUI(flowSDK: SDKFlowType[])
|
|
42
|
+
var ekycFlowType_1 = require("./src/types/ekycFlowType");
|
|
43
|
+
Object.defineProperty(exports, "SDKFlowType", { enumerable: true, get: function () { return ekycFlowType_1.SDKFlowType; } });
|
|
44
|
+
Object.defineProperty(exports, "SDK_FLOW_OPTIONS", { enumerable: true, get: function () { return ekycFlowType_1.SDK_FLOW_OPTIONS; } });
|
|
45
|
+
Object.defineProperty(exports, "flowToStrings", { enumerable: true, get: function () { return ekycFlowType_1.flowToStrings; } });
|
|
41
46
|
var ekycLivenessType_1 = require("./src/types/ekycLivenessType");
|
|
42
47
|
Object.defineProperty(exports, "SDKFaceDetectStatus", { enumerable: true, get: function () { return ekycLivenessType_1.SDKFaceDetectStatus; } });
|
|
48
|
+
Object.defineProperty(exports, "SDK_LIVENESS_ACTIONS", { enumerable: true, get: function () { return ekycLivenessType_1.SDK_LIVENESS_ACTIONS; } });
|
|
49
|
+
Object.defineProperty(exports, "customActionsToStrings", { enumerable: true, get: function () { return ekycLivenessType_1.customActionsToStrings; } });
|
|
43
50
|
// Export utility functions
|
|
44
51
|
var utils_1 = require("./src/utils/utils");
|
|
45
52
|
Object.defineProperty(exports, "parseNfcResponse", { enumerable: true, get: function () { return utils_1.parseNfcResponse; } });
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos_sdk/sdk-ekyc",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "React Native SDK for eKYC - Vietnamese CCCD NFC reading, OCR, Liveness detection, Face matching, and C06, eSign, SmsOTP residence verification",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -3,10 +3,11 @@ import { NfcConfig, NfcError } from '../types/ekycNFCType';
|
|
|
3
3
|
import { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent } from '../types/ekycType';
|
|
4
4
|
import { C06Config } from '../types/ekycC06Type';
|
|
5
5
|
import { OcrConfig } from '../types/ekycOCRType';
|
|
6
|
-
import { LivenessConfig } from '../types/ekycLivenessType';
|
|
6
|
+
import { LivenessConfig, SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
7
7
|
import { FaceServiceConfig } from '../types/ekycFaceType';
|
|
8
8
|
import { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
9
9
|
import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError } from '../types/ekycESignType';
|
|
10
|
+
import { SDKFlowType } from '../types/ekycFlowType';
|
|
10
11
|
/**
|
|
11
12
|
* Finos eKYC SDK Module
|
|
12
13
|
*
|
|
@@ -72,13 +73,13 @@ export declare class FinosEKYCModule {
|
|
|
72
73
|
* @param config.isActiveLiveness - Enable active liveness detection (default: false)
|
|
73
74
|
* @param config.autoCapture - Enable auto capture (default: true)
|
|
74
75
|
* @param config.isShowCameraFont - Show camera font (default: true)
|
|
75
|
-
* @param config.customActions -
|
|
76
|
+
* @param config.customActions - SDKFaceDetectStatus[] enum (LEFT, RIGHT, SMILE, BLINK, ...). Bên sử dụng truyền enum thay vì string
|
|
76
77
|
* @param config.activeActionCount - Number of random actions (1-10), only used when customActions is null (default: 2)
|
|
77
78
|
* @param config.switchFrontCamera - Use front camera (default: false)
|
|
78
79
|
*/
|
|
79
80
|
startLiveness(config: LivenessConfig): Promise<SDKEkycResultStringWithEvent>;
|
|
80
81
|
/**
|
|
81
|
-
* Start face comparison
|
|
82
|
+
* Start face comparison (Face Service)
|
|
82
83
|
* @param config Face service configuration
|
|
83
84
|
*/
|
|
84
85
|
startFaceCompare(config: FaceServiceConfig): Promise<SDKEkycResultStringWithEvent>;
|
|
@@ -282,14 +283,14 @@ export declare class FinosEKYCModule {
|
|
|
282
283
|
/**
|
|
283
284
|
* Start eKYC UI with flow (like MainActivity.kt)
|
|
284
285
|
* @param appKey Main app key
|
|
285
|
-
* @param flowSDK Array of
|
|
286
|
+
* @param flowSDK Array of SDKFlowType enum (OCR, NFC, LIVENESS) – bên sử dụng truyền enum
|
|
286
287
|
* @param language Language code (vi/en)
|
|
287
288
|
* @param transactionId Transaction ID
|
|
288
289
|
* @param appKeyConfig Optional app key configuration
|
|
289
290
|
* @param optionConfig Optional configuration settings (includes switchFrontCamera for camera control)
|
|
290
291
|
* @param styleConfig Optional style configuration
|
|
291
292
|
*/
|
|
292
|
-
startEkycUI(appKey: string, flowSDK:
|
|
293
|
+
startEkycUI(appKey: string, flowSDK: SDKFlowType[], language: string, transactionId: string, appKeyConfig: {
|
|
293
294
|
appKey: string;
|
|
294
295
|
appKeyNfc: string;
|
|
295
296
|
appKeyOcr: string;
|
|
@@ -301,6 +302,13 @@ export declare class FinosEKYCModule {
|
|
|
301
302
|
countMaxRetry?: number;
|
|
302
303
|
language?: string;
|
|
303
304
|
switchFrontCamera?: boolean;
|
|
305
|
+
/** LivenessConfig – SDKeKYCActivity (157-169) */
|
|
306
|
+
isActiveLiveness?: boolean;
|
|
307
|
+
autoCapture?: boolean;
|
|
308
|
+
forceCaptureTimeout?: number;
|
|
309
|
+
/** Bên sử dụng truyền enum – SDKFaceDetectStatus[] thay vì string[] */
|
|
310
|
+
customActions?: SDKFaceDetectStatus[];
|
|
311
|
+
activeActionCount?: number;
|
|
304
312
|
}, styleConfig?: {
|
|
305
313
|
textSize?: number;
|
|
306
314
|
textFont?: string;
|
|
@@ -28,6 +28,7 @@ const react_native_1 = require("react-native");
|
|
|
28
28
|
const EKYCModule_1 = __importStar(require("../../EKYCModule"));
|
|
29
29
|
Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return EKYCModule_1.SDK_VERSION; } });
|
|
30
30
|
Object.defineProperty(exports, "SDK_NAME", { enumerable: true, get: function () { return EKYCModule_1.SDK_NAME; } });
|
|
31
|
+
const ekycFlowType_1 = require("../types/ekycFlowType");
|
|
31
32
|
/**
|
|
32
33
|
* Finos eKYC SDK Module
|
|
33
34
|
*
|
|
@@ -184,7 +185,7 @@ class FinosEKYCModule {
|
|
|
184
185
|
* @param config.isActiveLiveness - Enable active liveness detection (default: false)
|
|
185
186
|
* @param config.autoCapture - Enable auto capture (default: true)
|
|
186
187
|
* @param config.isShowCameraFont - Show camera font (default: true)
|
|
187
|
-
* @param config.customActions -
|
|
188
|
+
* @param config.customActions - SDKFaceDetectStatus[] enum (LEFT, RIGHT, SMILE, BLINK, ...). Bên sử dụng truyền enum thay vì string
|
|
188
189
|
* @param config.activeActionCount - Number of random actions (1-10), only used when customActions is null (default: 2)
|
|
189
190
|
* @param config.switchFrontCamera - Use front camera (default: false)
|
|
190
191
|
*/
|
|
@@ -214,19 +215,20 @@ class FinosEKYCModule {
|
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
/**
|
|
217
|
-
* Start face comparison
|
|
218
|
+
* Start face comparison (Face Service)
|
|
218
219
|
* @param config Face service configuration
|
|
219
220
|
*/
|
|
220
221
|
async startFaceCompare(config) {
|
|
221
222
|
this.validateSDKReady();
|
|
223
|
+
const normalized = Object.assign(Object.assign({}, config), { appKey: (config.appKeyFaceService || config.appKey) });
|
|
222
224
|
try {
|
|
223
|
-
console.log('👤 Starting face
|
|
224
|
-
const result = await this.sdk.startFaceCompare(
|
|
225
|
-
console.log('✅ Face
|
|
225
|
+
console.log('👤 Starting face compare...');
|
|
226
|
+
const result = await this.sdk.startFaceCompare(normalized);
|
|
227
|
+
console.log('✅ Face compare completed:', result.event);
|
|
226
228
|
return result;
|
|
227
229
|
}
|
|
228
230
|
catch (error) {
|
|
229
|
-
console.error('❌ Face
|
|
231
|
+
console.error('❌ Face compare failed:', error);
|
|
230
232
|
throw error;
|
|
231
233
|
}
|
|
232
234
|
}
|
|
@@ -631,7 +633,7 @@ class FinosEKYCModule {
|
|
|
631
633
|
/**
|
|
632
634
|
* Start eKYC UI with flow (like MainActivity.kt)
|
|
633
635
|
* @param appKey Main app key
|
|
634
|
-
* @param flowSDK Array of
|
|
636
|
+
* @param flowSDK Array of SDKFlowType enum (OCR, NFC, LIVENESS) – bên sử dụng truyền enum
|
|
635
637
|
* @param language Language code (vi/en)
|
|
636
638
|
* @param transactionId Transaction ID
|
|
637
639
|
* @param appKeyConfig Optional app key configuration
|
|
@@ -648,7 +650,7 @@ class FinosEKYCModule {
|
|
|
648
650
|
}
|
|
649
651
|
console.log('🔑 AppKeyConfig:', appKeyConfig);
|
|
650
652
|
console.log('🎨 StyleConfig:', styleConfig);
|
|
651
|
-
const result = await this.sdk.startEkycUI(appKey, flowSDK, language, transactionId, appKeyConfig, optionConfig, styleConfig);
|
|
653
|
+
const result = await this.sdk.startEkycUI(appKey, (0, ekycFlowType_1.flowToStrings)(flowSDK), language, transactionId, appKeyConfig, optionConfig, styleConfig);
|
|
652
654
|
console.log('✅ eKYC UI started successfully');
|
|
653
655
|
return result;
|
|
654
656
|
}
|
|
@@ -151,6 +151,15 @@ export declare class FinosESignModule {
|
|
|
151
151
|
sendConfirmationDocument(requestJson: string): Promise<{
|
|
152
152
|
response: string;
|
|
153
153
|
}>;
|
|
154
|
+
/**
|
|
155
|
+
* Composite API: Register Remote Signing + Send Confirmation Document
|
|
156
|
+
* Align với SdkeSignImpl.registerAndConfirm
|
|
157
|
+
* @param requestJson JSON request body for registerRemoteSigning
|
|
158
|
+
* @param confirmationDocBase64 PDF base64 for acceptanceDocs
|
|
159
|
+
*/
|
|
160
|
+
registerAndConfirm(requestJson: string, confirmationDocBase64: string): Promise<{
|
|
161
|
+
response: string;
|
|
162
|
+
}>;
|
|
154
163
|
/**
|
|
155
164
|
* Remove all event listeners
|
|
156
165
|
*/
|
|
@@ -184,6 +193,9 @@ export declare class FinosESignModule {
|
|
|
184
193
|
onESignSendConfirmationDocumentSuccess(callback: (data: {
|
|
185
194
|
response: string;
|
|
186
195
|
}) => void): import("react-native").EmitterSubscription | null;
|
|
196
|
+
onESignRegisterAndConfirmSuccess(callback: (data: {
|
|
197
|
+
response: string;
|
|
198
|
+
}) => void): import("react-native").EmitterSubscription | null;
|
|
187
199
|
onESignError(callback: (error: ESignError) => void): import("react-native").EmitterSubscription | null;
|
|
188
200
|
/**
|
|
189
201
|
* Start liveness detection
|
|
@@ -199,7 +211,7 @@ export declare class FinosESignModule {
|
|
|
199
211
|
onLivenessSuccess(callback: (data: SDKEkycResultStringWithEvent) => void): import("react-native").EmitterSubscription | null;
|
|
200
212
|
onLivenessError(callback: (error: any) => void): import("react-native").EmitterSubscription | null;
|
|
201
213
|
/**
|
|
202
|
-
*
|
|
214
|
+
* Face matching (Face Service)
|
|
203
215
|
* @param config Face service configuration
|
|
204
216
|
*/
|
|
205
217
|
startFaceCompare(config: FaceServiceConfig): Promise<SDKEkycResultStringWithEvent>;
|
|
@@ -281,6 +281,16 @@ class FinosESignModule {
|
|
|
281
281
|
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
282
282
|
return await this.sdk.sendConfirmationDocument(requestJson);
|
|
283
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Composite API: Register Remote Signing + Send Confirmation Document
|
|
286
|
+
* Align với SdkeSignImpl.registerAndConfirm
|
|
287
|
+
* @param requestJson JSON request body for registerRemoteSigning
|
|
288
|
+
* @param confirmationDocBase64 PDF base64 for acceptanceDocs
|
|
289
|
+
*/
|
|
290
|
+
async registerAndConfirm(requestJson, confirmationDocBase64) {
|
|
291
|
+
this.validateSDKReady();
|
|
292
|
+
return await this.sdk.registerAndConfirm(requestJson, confirmationDocBase64);
|
|
293
|
+
}
|
|
284
294
|
/**
|
|
285
295
|
* Remove all event listeners
|
|
286
296
|
*/
|
|
@@ -359,6 +369,13 @@ class FinosESignModule {
|
|
|
359
369
|
}
|
|
360
370
|
return listener;
|
|
361
371
|
}
|
|
372
|
+
onESignRegisterAndConfirmSuccess(callback) {
|
|
373
|
+
const listener = this.sdk.onESignRegisterAndConfirmSuccess(callback);
|
|
374
|
+
if (!listener) {
|
|
375
|
+
console.warn('⚠️ onESignRegisterAndConfirmSuccess: Event emitter not ready.');
|
|
376
|
+
}
|
|
377
|
+
return listener;
|
|
378
|
+
}
|
|
362
379
|
onESignError(callback) {
|
|
363
380
|
const listener = this.sdk.onESignError(callback);
|
|
364
381
|
if (!listener) {
|
|
@@ -391,13 +408,14 @@ class FinosESignModule {
|
|
|
391
408
|
}
|
|
392
409
|
// ==================== Face Service Methods ====================
|
|
393
410
|
/**
|
|
394
|
-
*
|
|
411
|
+
* Face matching (Face Service)
|
|
395
412
|
* @param config Face service configuration
|
|
396
413
|
*/
|
|
397
414
|
async startFaceCompare(config) {
|
|
398
415
|
this.validateSDKReady();
|
|
416
|
+
const normalized = Object.assign(Object.assign({}, config), { appKey: (config.appKeyFaceService || config.appKey) });
|
|
399
417
|
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
400
|
-
return await this.sdk.startFaceCompare(
|
|
418
|
+
return await this.sdk.startFaceCompare(normalized);
|
|
401
419
|
}
|
|
402
420
|
// Face Compare Event Listeners
|
|
403
421
|
onFaceCompareSuccess(callback) {
|
|
@@ -491,6 +509,7 @@ const isMethod = (prop) => {
|
|
|
491
509
|
prop === 'listSignRequest' ||
|
|
492
510
|
prop === 'confirmSign' ||
|
|
493
511
|
prop === 'registerRemoteSigning' ||
|
|
512
|
+
prop === 'registerAndConfirm' ||
|
|
494
513
|
prop === 'signPdf' ||
|
|
495
514
|
prop === 'sendConfirmationDocument' ||
|
|
496
515
|
prop === 'startLiveness' ||
|
|
@@ -547,7 +566,7 @@ const createFinosESignStub = () => {
|
|
|
547
566
|
'onESignInitSuccess', 'onESignOpenSessionSuccess', 'onESignRegisterDeviceSuccess',
|
|
548
567
|
'onESignListCertsSuccess', 'onESignVerifyCertSuccess', 'onESignListSignRequestSuccess',
|
|
549
568
|
'onESignConfirmSignSuccess', 'onESignRegisterRemoteSigningSuccess',
|
|
550
|
-
'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignError',
|
|
569
|
+
'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignRegisterAndConfirmSuccess', 'onESignError',
|
|
551
570
|
'onLivenessSuccess', 'onLivenessError', 'onFaceCompareSuccess', 'onFaceCompareError'
|
|
552
571
|
];
|
|
553
572
|
eventListenerMethods.forEach(method => {
|
|
@@ -561,7 +580,7 @@ const createFinosESignStub = () => {
|
|
|
561
580
|
'initialize', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
|
|
562
581
|
'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'getSdkToken', 'openSessionId',
|
|
563
582
|
'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
|
|
564
|
-
'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
|
|
583
|
+
'registerRemoteSigning', 'registerAndConfirm', 'signPdf', 'sendConfirmationDocument',
|
|
565
584
|
'onResume', 'onPause', 'isSDKReady', 'getSDKInfo'
|
|
566
585
|
];
|
|
567
586
|
otherMethods.forEach(method => {
|
|
@@ -13,7 +13,14 @@ export interface FaceVerifyResult {
|
|
|
13
13
|
toBeReviewed?: string;
|
|
14
14
|
}
|
|
15
15
|
export interface FaceServiceConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Backward/forward compatible:
|
|
18
|
+
* - SDK code uses `appKey`
|
|
19
|
+
* - Some integration docs use `appKeyFaceService`
|
|
20
|
+
* Provide either; `startFaceCompare()` will normalize.
|
|
21
|
+
*/
|
|
16
22
|
appKey: string;
|
|
23
|
+
appKeyFaceService?: string;
|
|
17
24
|
transactionId?: string;
|
|
18
25
|
selfieImage: string;
|
|
19
26
|
idImage: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Các bước trong flow eKYC – map với Android SDKType (OCR, NFC, LIVENESS).
|
|
3
|
+
* Bên sử dụng truyền enum vào SDK thay vì string.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* import { FinosEKYC, SDKFlowType } from '@finos_sdk/sdk-ekyc';
|
|
7
|
+
* await FinosEKYC.startEkycUI(appKey, [SDKFlowType.OCR, SDKFlowType.NFC, SDKFlowType.LIVENESS], ...);
|
|
8
|
+
*/
|
|
9
|
+
export declare enum SDKFlowType {
|
|
10
|
+
OCR = "OCR",
|
|
11
|
+
NFC = "NFC",
|
|
12
|
+
LIVENESS = "LIVENESS"
|
|
13
|
+
}
|
|
14
|
+
/** Mảng đầy đủ các bước (dùng cho picker / default flow). */
|
|
15
|
+
export declare const SDK_FLOW_OPTIONS: readonly SDKFlowType[];
|
|
16
|
+
/** Chuyển flow enum[] sang string[] khi gửi xuống native (giá trị enum đã là 'OCR'|'NFC'|'LIVENESS'). */
|
|
17
|
+
export declare function flowToStrings(flow: SDKFlowType[]): string[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flowToStrings = exports.SDK_FLOW_OPTIONS = exports.SDKFlowType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Các bước trong flow eKYC – map với Android SDKType (OCR, NFC, LIVENESS).
|
|
6
|
+
* Bên sử dụng truyền enum vào SDK thay vì string.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* import { FinosEKYC, SDKFlowType } from '@finos_sdk/sdk-ekyc';
|
|
10
|
+
* await FinosEKYC.startEkycUI(appKey, [SDKFlowType.OCR, SDKFlowType.NFC, SDKFlowType.LIVENESS], ...);
|
|
11
|
+
*/
|
|
12
|
+
var SDKFlowType;
|
|
13
|
+
(function (SDKFlowType) {
|
|
14
|
+
SDKFlowType["OCR"] = "OCR";
|
|
15
|
+
SDKFlowType["NFC"] = "NFC";
|
|
16
|
+
SDKFlowType["LIVENESS"] = "LIVENESS";
|
|
17
|
+
})(SDKFlowType = exports.SDKFlowType || (exports.SDKFlowType = {}));
|
|
18
|
+
/** Mảng đầy đủ các bước (dùng cho picker / default flow). */
|
|
19
|
+
exports.SDK_FLOW_OPTIONS = [
|
|
20
|
+
SDKFlowType.OCR,
|
|
21
|
+
SDKFlowType.NFC,
|
|
22
|
+
SDKFlowType.LIVENESS,
|
|
23
|
+
];
|
|
24
|
+
/** Chuyển flow enum[] sang string[] khi gửi xuống native (giá trị enum đã là 'OCR'|'NFC'|'LIVENESS'). */
|
|
25
|
+
function flowToStrings(flow) {
|
|
26
|
+
return flow.map(f => f);
|
|
27
|
+
}
|
|
28
|
+
exports.flowToStrings = flowToStrings;
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import { CheckSummaryResponse } from "./ekycOCRType";
|
|
2
|
+
/**
|
|
3
|
+
* Custom actions cho liveness – map Android SDKFaceDetectStatus.
|
|
4
|
+
* Bên sử dụng truyền enum vào optionConfig.customActions thay vì string.
|
|
5
|
+
*/
|
|
2
6
|
export declare enum SDKFaceDetectStatus {
|
|
3
7
|
LEFT = "LEFT",
|
|
4
8
|
RIGHT = "RIGHT",
|
|
9
|
+
UP = "UP",
|
|
10
|
+
DOWN = "DOWN",
|
|
11
|
+
SMILE = "SMILE",
|
|
12
|
+
BLINK = "BLINK",
|
|
13
|
+
TILT_LEFT = "TILT_LEFT",
|
|
14
|
+
TILT_RIGHT = "TILT_RIGHT",
|
|
15
|
+
WINK_LEFT = "WINK_LEFT",
|
|
16
|
+
WINK_RIGHT = "WINK_RIGHT",
|
|
5
17
|
STRAIGHT = "STRAIGHT"
|
|
6
18
|
}
|
|
19
|
+
/** Mảng đầy đủ các action (trừ STRAIGHT thường được SDK tự thêm cuối) – dùng cho picker / default. */
|
|
20
|
+
export declare const SDK_LIVENESS_ACTIONS: readonly SDKFaceDetectStatus[];
|
|
21
|
+
/** Chuyển customActions enum[] sang string[] khi gửi xuống native. */
|
|
22
|
+
export declare function customActionsToStrings(actions: SDKFaceDetectStatus[]): string[];
|
|
7
23
|
export interface LivenessConfig {
|
|
8
24
|
appKey: string;
|
|
9
25
|
transactionId?: string;
|
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SDKFaceDetectStatus = void 0;
|
|
3
|
+
exports.customActionsToStrings = exports.SDK_LIVENESS_ACTIONS = exports.SDKFaceDetectStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Custom actions cho liveness – map Android SDKFaceDetectStatus.
|
|
6
|
+
* Bên sử dụng truyền enum vào optionConfig.customActions thay vì string.
|
|
7
|
+
*/
|
|
4
8
|
var SDKFaceDetectStatus;
|
|
5
9
|
(function (SDKFaceDetectStatus) {
|
|
6
10
|
SDKFaceDetectStatus["LEFT"] = "LEFT";
|
|
7
11
|
SDKFaceDetectStatus["RIGHT"] = "RIGHT";
|
|
12
|
+
SDKFaceDetectStatus["UP"] = "UP";
|
|
13
|
+
SDKFaceDetectStatus["DOWN"] = "DOWN";
|
|
14
|
+
SDKFaceDetectStatus["SMILE"] = "SMILE";
|
|
15
|
+
SDKFaceDetectStatus["BLINK"] = "BLINK";
|
|
16
|
+
SDKFaceDetectStatus["TILT_LEFT"] = "TILT_LEFT";
|
|
17
|
+
SDKFaceDetectStatus["TILT_RIGHT"] = "TILT_RIGHT";
|
|
18
|
+
SDKFaceDetectStatus["WINK_LEFT"] = "WINK_LEFT";
|
|
19
|
+
SDKFaceDetectStatus["WINK_RIGHT"] = "WINK_RIGHT";
|
|
8
20
|
SDKFaceDetectStatus["STRAIGHT"] = "STRAIGHT";
|
|
9
21
|
})(SDKFaceDetectStatus = exports.SDKFaceDetectStatus || (exports.SDKFaceDetectStatus = {}));
|
|
22
|
+
/** Mảng đầy đủ các action (trừ STRAIGHT thường được SDK tự thêm cuối) – dùng cho picker / default. */
|
|
23
|
+
exports.SDK_LIVENESS_ACTIONS = [
|
|
24
|
+
SDKFaceDetectStatus.LEFT,
|
|
25
|
+
SDKFaceDetectStatus.RIGHT,
|
|
26
|
+
SDKFaceDetectStatus.UP,
|
|
27
|
+
SDKFaceDetectStatus.DOWN,
|
|
28
|
+
SDKFaceDetectStatus.SMILE,
|
|
29
|
+
SDKFaceDetectStatus.BLINK,
|
|
30
|
+
SDKFaceDetectStatus.TILT_LEFT,
|
|
31
|
+
SDKFaceDetectStatus.TILT_RIGHT,
|
|
32
|
+
SDKFaceDetectStatus.WINK_LEFT,
|
|
33
|
+
SDKFaceDetectStatus.WINK_RIGHT,
|
|
34
|
+
SDKFaceDetectStatus.STRAIGHT,
|
|
35
|
+
];
|
|
36
|
+
/** Chuyển customActions enum[] sang string[] khi gửi xuống native. */
|
|
37
|
+
function customActionsToStrings(actions) {
|
|
38
|
+
return actions.map(a => a);
|
|
39
|
+
}
|
|
40
|
+
exports.customActionsToStrings = customActionsToStrings;
|
|
@@ -20,3 +20,33 @@ export interface SDKEkycResultStringWithEvent {
|
|
|
20
20
|
data: string;
|
|
21
21
|
event: string;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Result from startEkycUI() – maps Android SDK data.ekycStateModel.eKYCFileModel.
|
|
25
|
+
* Use the same shape as Android: data?.ekycStateModel?.eKYCFileModel?.imageFace.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const result = await sdkEKYC.startEkycUI(...);
|
|
29
|
+
* const selfieBase64 = result?.imageFace; // base64 selfie (liveness/face)
|
|
30
|
+
* const frontBase64 = result?.imageOcrFront; // base64 CCCD/CMND mặt trước
|
|
31
|
+
* const backBase64 = result?.imageOcrBack; // base64 CCCD/CMND mặt sau
|
|
32
|
+
* const selfiePath = result?.imageFacePath; // file path (e.g. for FormData)
|
|
33
|
+
* const transactionId = result?.transactionId;
|
|
34
|
+
*/
|
|
35
|
+
export interface StartEkycUIResult {
|
|
36
|
+
status: 'success';
|
|
37
|
+
event: string;
|
|
38
|
+
data?: string;
|
|
39
|
+
transactionId?: string;
|
|
40
|
+
/** Base64 selfie (liveness) – same as Android data.ekycStateModel.eKYCFileModel.imageFace */
|
|
41
|
+
imageFace?: string;
|
|
42
|
+
/** Base64 OCR front – same as Android eKYCFileModel.imageOcrFront */
|
|
43
|
+
imageOcrFront?: string;
|
|
44
|
+
/** Base64 OCR back – same as Android eKYCFileModel.imageOcrBack */
|
|
45
|
+
imageOcrBack?: string;
|
|
46
|
+
/** Absolute path to selfie file (e.g. for react-native-fs / FormData) */
|
|
47
|
+
imageFacePath?: string;
|
|
48
|
+
/** Absolute path to OCR front image file */
|
|
49
|
+
imageOcrFrontPath?: string;
|
|
50
|
+
/** Absolute path to OCR back image file */
|
|
51
|
+
imageOcrBackPath?: string;
|
|
52
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos_sdk/sdk-ekyc",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "React Native SDK for eKYC - Vietnamese CCCD NFC reading, OCR, Liveness detection, Face matching, and C06, eSign, SmsOTP residence verification",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -4,10 +4,11 @@ import { NfcConfig, NfcError } from '../types/ekycNFCType';
|
|
|
4
4
|
import { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent } from '../types/ekycType';
|
|
5
5
|
import { C06Config } from '../types/ekycC06Type';
|
|
6
6
|
import { OcrConfig } from '../types/ekycOCRType';
|
|
7
|
-
import { LivenessConfig } from '../types/ekycLivenessType';
|
|
7
|
+
import { LivenessConfig, SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
8
8
|
import { FaceServiceConfig } from '../types/ekycFaceType';
|
|
9
9
|
import { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
10
10
|
import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
|
|
11
|
+
import { SDKFlowType, flowToStrings } from '../types/ekycFlowType';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Finos eKYC SDK Module
|
|
@@ -189,7 +190,7 @@ export class FinosEKYCModule {
|
|
|
189
190
|
* @param config.isActiveLiveness - Enable active liveness detection (default: false)
|
|
190
191
|
* @param config.autoCapture - Enable auto capture (default: true)
|
|
191
192
|
* @param config.isShowCameraFont - Show camera font (default: true)
|
|
192
|
-
* @param config.customActions -
|
|
193
|
+
* @param config.customActions - SDKFaceDetectStatus[] enum (LEFT, RIGHT, SMILE, BLINK, ...). Bên sử dụng truyền enum thay vì string
|
|
193
194
|
* @param config.activeActionCount - Number of random actions (1-10), only used when customActions is null (default: 2)
|
|
194
195
|
* @param config.switchFrontCamera - Use front camera (default: false)
|
|
195
196
|
*/
|
|
@@ -222,19 +223,24 @@ export class FinosEKYCModule {
|
|
|
222
223
|
}
|
|
223
224
|
|
|
224
225
|
/**
|
|
225
|
-
* Start face comparison
|
|
226
|
+
* Start face comparison (Face Service)
|
|
226
227
|
* @param config Face service configuration
|
|
227
228
|
*/
|
|
228
229
|
public async startFaceCompare(config: FaceServiceConfig): Promise<SDKEkycResultStringWithEvent> {
|
|
229
230
|
this.validateSDKReady();
|
|
230
231
|
|
|
232
|
+
const normalized: FaceServiceConfig = {
|
|
233
|
+
...config,
|
|
234
|
+
appKey: (config.appKeyFaceService || config.appKey),
|
|
235
|
+
};
|
|
236
|
+
|
|
231
237
|
try {
|
|
232
|
-
console.log('👤 Starting face
|
|
233
|
-
const result = await this.sdk.startFaceCompare(
|
|
234
|
-
console.log('✅ Face
|
|
238
|
+
console.log('👤 Starting face compare...');
|
|
239
|
+
const result = await this.sdk.startFaceCompare(normalized);
|
|
240
|
+
console.log('✅ Face compare completed:', result.event);
|
|
235
241
|
return result;
|
|
236
242
|
} catch (error) {
|
|
237
|
-
console.error('❌ Face
|
|
243
|
+
console.error('❌ Face compare failed:', error);
|
|
238
244
|
throw error;
|
|
239
245
|
}
|
|
240
246
|
}
|
|
@@ -721,7 +727,7 @@ export class FinosEKYCModule {
|
|
|
721
727
|
/**
|
|
722
728
|
* Start eKYC UI with flow (like MainActivity.kt)
|
|
723
729
|
* @param appKey Main app key
|
|
724
|
-
* @param flowSDK Array of
|
|
730
|
+
* @param flowSDK Array of SDKFlowType enum (OCR, NFC, LIVENESS) – bên sử dụng truyền enum
|
|
725
731
|
* @param language Language code (vi/en)
|
|
726
732
|
* @param transactionId Transaction ID
|
|
727
733
|
* @param appKeyConfig Optional app key configuration
|
|
@@ -730,7 +736,7 @@ export class FinosEKYCModule {
|
|
|
730
736
|
*/
|
|
731
737
|
public async startEkycUI(
|
|
732
738
|
appKey: string,
|
|
733
|
-
flowSDK:
|
|
739
|
+
flowSDK: SDKFlowType[],
|
|
734
740
|
language: string,
|
|
735
741
|
transactionId: string,
|
|
736
742
|
appKeyConfig: {
|
|
@@ -746,6 +752,13 @@ export class FinosEKYCModule {
|
|
|
746
752
|
countMaxRetry?: number;
|
|
747
753
|
language?: string;
|
|
748
754
|
switchFrontCamera?: boolean;
|
|
755
|
+
/** LivenessConfig – SDKeKYCActivity (157-169) */
|
|
756
|
+
isActiveLiveness?: boolean;
|
|
757
|
+
autoCapture?: boolean;
|
|
758
|
+
forceCaptureTimeout?: number; // seconds, native uses ms
|
|
759
|
+
/** Bên sử dụng truyền enum – SDKFaceDetectStatus[] thay vì string[] */
|
|
760
|
+
customActions?: SDKFaceDetectStatus[];
|
|
761
|
+
activeActionCount?: number;
|
|
749
762
|
},
|
|
750
763
|
styleConfig?: {
|
|
751
764
|
textSize?: number;
|
|
@@ -798,7 +811,7 @@ export class FinosEKYCModule {
|
|
|
798
811
|
|
|
799
812
|
const result = await this.sdk.startEkycUI(
|
|
800
813
|
appKey,
|
|
801
|
-
flowSDK,
|
|
814
|
+
flowToStrings(flowSDK),
|
|
802
815
|
language,
|
|
803
816
|
transactionId,
|
|
804
817
|
appKeyConfig,
|
|
@@ -333,6 +333,20 @@ export class FinosESignModule {
|
|
|
333
333
|
return await this.sdk.sendConfirmationDocument(requestJson);
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Composite API: Register Remote Signing + Send Confirmation Document
|
|
338
|
+
* Align với SdkeSignImpl.registerAndConfirm
|
|
339
|
+
* @param requestJson JSON request body for registerRemoteSigning
|
|
340
|
+
* @param confirmationDocBase64 PDF base64 for acceptanceDocs
|
|
341
|
+
*/
|
|
342
|
+
public async registerAndConfirm(
|
|
343
|
+
requestJson: string,
|
|
344
|
+
confirmationDocBase64: string
|
|
345
|
+
): Promise<{ response: string }> {
|
|
346
|
+
this.validateSDKReady();
|
|
347
|
+
return await this.sdk.registerAndConfirm(requestJson, confirmationDocBase64);
|
|
348
|
+
}
|
|
349
|
+
|
|
336
350
|
/**
|
|
337
351
|
* Remove all event listeners
|
|
338
352
|
*/
|
|
@@ -424,6 +438,14 @@ export class FinosESignModule {
|
|
|
424
438
|
return listener;
|
|
425
439
|
}
|
|
426
440
|
|
|
441
|
+
public onESignRegisterAndConfirmSuccess(callback: (data: { response: string }) => void) {
|
|
442
|
+
const listener = this.sdk.onESignRegisterAndConfirmSuccess(callback);
|
|
443
|
+
if (!listener) {
|
|
444
|
+
console.warn('⚠️ onESignRegisterAndConfirmSuccess: Event emitter not ready.');
|
|
445
|
+
}
|
|
446
|
+
return listener;
|
|
447
|
+
}
|
|
448
|
+
|
|
427
449
|
public onESignError(callback: (error: ESignError) => void) {
|
|
428
450
|
const listener = this.sdk.onESignError(callback);
|
|
429
451
|
if (!listener) {
|
|
@@ -462,13 +484,17 @@ export class FinosESignModule {
|
|
|
462
484
|
// ==================== Face Service Methods ====================
|
|
463
485
|
|
|
464
486
|
/**
|
|
465
|
-
*
|
|
487
|
+
* Face matching (Face Service)
|
|
466
488
|
* @param config Face service configuration
|
|
467
489
|
*/
|
|
468
490
|
public async startFaceCompare(config: FaceServiceConfig): Promise<SDKEkycResultStringWithEvent> {
|
|
469
491
|
this.validateSDKReady();
|
|
492
|
+
const normalized: FaceServiceConfig = {
|
|
493
|
+
...config,
|
|
494
|
+
appKey: (config.appKeyFaceService || config.appKey),
|
|
495
|
+
};
|
|
470
496
|
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
471
|
-
return await this.sdk.startFaceCompare(
|
|
497
|
+
return await this.sdk.startFaceCompare(normalized);
|
|
472
498
|
}
|
|
473
499
|
|
|
474
500
|
// Face Compare Event Listeners
|
|
@@ -633,6 +659,7 @@ const isMethod = (prop: string | symbol): boolean => {
|
|
|
633
659
|
prop === 'listSignRequest' ||
|
|
634
660
|
prop === 'confirmSign' ||
|
|
635
661
|
prop === 'registerRemoteSigning' ||
|
|
662
|
+
prop === 'registerAndConfirm' ||
|
|
636
663
|
prop === 'signPdf' ||
|
|
637
664
|
prop === 'sendConfirmationDocument' ||
|
|
638
665
|
prop === 'startLiveness' ||
|
|
@@ -689,8 +716,8 @@ const createFinosESignStub = (): FinosESignModule => {
|
|
|
689
716
|
'onSmsOtpSendSuccess', 'onSmsOtpVerifySuccess', 'onSmsOtpResendSuccess', 'onSmsOtpError',
|
|
690
717
|
'onESignInitSuccess', 'onESignOpenSessionSuccess', 'onESignRegisterDeviceSuccess',
|
|
691
718
|
'onESignListCertsSuccess', 'onESignVerifyCertSuccess', 'onESignListSignRequestSuccess',
|
|
692
|
-
'onESignConfirmSignSuccess',
|
|
693
|
-
'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignError',
|
|
719
|
+
'onESignConfirmSignSuccess', 'onESignRegisterRemoteSigningSuccess',
|
|
720
|
+
'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignRegisterAndConfirmSuccess', 'onESignError',
|
|
694
721
|
'onLivenessSuccess', 'onLivenessError', 'onFaceCompareSuccess', 'onFaceCompareError'
|
|
695
722
|
];
|
|
696
723
|
|
|
@@ -706,7 +733,7 @@ const createFinosESignStub = (): FinosESignModule => {
|
|
|
706
733
|
'initialize', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
|
|
707
734
|
'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'getSdkToken', 'openSessionId',
|
|
708
735
|
'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
|
|
709
|
-
'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
|
|
736
|
+
'registerRemoteSigning', 'registerAndConfirm', 'signPdf', 'sendConfirmationDocument',
|
|
710
737
|
'onResume', 'onPause', 'isSDKReady', 'getSDKInfo'
|
|
711
738
|
];
|
|
712
739
|
|