@finos_sdk/sdk-ekyc 1.3.1 → 1.3.3

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.
@@ -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
- import { UserEsignModel, ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError } from '../types/ekycESignType';
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,7 +73,7 @@ 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 - Custom actions array (LEFT, RIGHT, STRAIGHT). If provided, uses these actions instead of random
76
+ * @param config.customActions - SDKFaceDetectStatus[] enum (LEFT, RIGHT, SMILE, BLINK, ...). Bên sử dụng truyền enum thay 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
  */
@@ -171,14 +172,14 @@ export declare class FinosEKYCModule {
171
172
  */
172
173
  initializeESign(): Promise<ESignInitResult>;
173
174
  /**
174
- * Open eSign session
175
- * @param accessToken JWT access token (optional if using userEsignModel)
176
- * @param username Optional username
177
- * @param rememberMe Remember session
178
- * @param userEsignModel User info for auto token creation (optional if using accessToken)
179
- * @param privateKeyFilePath Path to private key file in assets (required if using userEsignModel)
175
+ * Open eSign Session
176
+ * @param accessToken Access token (JWT)
177
+ * @param username Username
178
+ * @param rememberMe Remember me flag
179
+ * @param userEsignModel User info model (for auto-token generation)
180
+ * @param privateKeyFilePath Path to private key file (for auto-token generation)
180
181
  */
181
- openSessionId(accessToken?: string, username?: string, rememberMe?: boolean, userEsignModel?: UserEsignModel, privateKeyFilePath?: string): Promise<ESignOpenSessionResult>;
182
+ openSessionId(accessToken: string | null, username: string | null, rememberMe: boolean | null): Promise<ESignOpenSessionResult>;
182
183
  /**
183
184
  * Register device for eSign
184
185
  * @param recoverCode 8-digit recovery code
@@ -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 SDK types
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: string[], language: string, transactionId: string, appKeyConfig: {
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;
@@ -350,6 +358,6 @@ export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
350
358
  export type { FaceServiceConfig } from '../types/ekycFaceType';
351
359
  export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent } from '../types/ekycType';
352
360
  export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
353
- export type { UserEsignModel, ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
361
+ export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
354
362
  export { SDK_VERSION, SDK_NAME };
355
363
  export default FinosEKYC;
@@ -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 - Custom actions array (LEFT, RIGHT, STRAIGHT). If provided, uses these actions instead of random
188
+ * @param config.customActions - SDKFaceDetectStatus[] enum (LEFT, RIGHT, SMILE, BLINK, ...). Bên sử dụng truyền enum thay 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
  */
@@ -435,25 +436,17 @@ class FinosEKYCModule {
435
436
  }
436
437
  }
437
438
  /**
438
- * Open eSign session
439
- * @param accessToken JWT access token (optional if using userEsignModel)
440
- * @param username Optional username
441
- * @param rememberMe Remember session
442
- * @param userEsignModel User info for auto token creation (optional if using accessToken)
443
- * @param privateKeyFilePath Path to private key file in assets (required if using userEsignModel)
439
+ * Open eSign Session
440
+ * @param accessToken Access token (JWT)
441
+ * @param username Username
442
+ * @param rememberMe Remember me flag
443
+ * @param userEsignModel User info model (for auto-token generation)
444
+ * @param privateKeyFilePath Path to private key file (for auto-token generation)
444
445
  */
445
- async openSessionId(accessToken, username, rememberMe, userEsignModel, privateKeyFilePath) {
446
+ async openSessionId(accessToken, username, rememberMe) {
446
447
  this.validateSDKReady();
447
- try {
448
- console.log('🔓 Opening eSign session...');
449
- const result = await this.sdk.openSessionId(accessToken, username, rememberMe, userEsignModel, privateKeyFilePath);
450
- console.log('✅ eSign session opened successfully');
451
- return result;
452
- }
453
- catch (error) {
454
- console.error('❌ eSign session open failed:', error);
455
- throw error;
456
- }
448
+ // Pass through to SDK - error handling is done in EKYCModule.ts
449
+ return await this.sdk.openSessionId(accessToken, username, rememberMe);
457
450
  }
458
451
  /**
459
452
  * Register device for eSign
@@ -639,7 +632,7 @@ class FinosEKYCModule {
639
632
  /**
640
633
  * Start eKYC UI with flow (like MainActivity.kt)
641
634
  * @param appKey Main app key
642
- * @param flowSDK Array of SDK types
635
+ * @param flowSDK Array of SDKFlowType enum (OCR, NFC, LIVENESS) – bên sử dụng truyền enum
643
636
  * @param language Language code (vi/en)
644
637
  * @param transactionId Transaction ID
645
638
  * @param appKeyConfig Optional app key configuration
@@ -656,7 +649,7 @@ class FinosEKYCModule {
656
649
  }
657
650
  console.log('🔑 AppKeyConfig:', appKeyConfig);
658
651
  console.log('🎨 StyleConfig:', styleConfig);
659
- const result = await this.sdk.startEkycUI(appKey, flowSDK, language, transactionId, appKeyConfig, optionConfig, styleConfig);
652
+ const result = await this.sdk.startEkycUI(appKey, (0, ekycFlowType_1.flowToStrings)(flowSDK), language, transactionId, appKeyConfig, optionConfig, styleConfig);
660
653
  console.log('✅ eKYC UI started successfully');
661
654
  return result;
662
655
  }
@@ -708,6 +701,7 @@ const isMethod = (prop) => {
708
701
  return typeof prototype[prop] === 'function' ||
709
702
  prop.startsWith('on') ||
710
703
  prop === 'initialize' ||
704
+ prop === 'openSessionId' ||
711
705
  prop === 'startEkycUI' ||
712
706
  prop === 'startNfcScan' ||
713
707
  prop === 'checkC06' ||
@@ -1,6 +1,6 @@
1
1
  import { SDK_VERSION, SDK_NAME } from '../../EKYCModule';
2
2
  import { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
3
- import { UserEsignModel, ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError } from '../types/ekycESignType';
3
+ import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError } from '../types/ekycESignType';
4
4
  import { LivenessConfig } from '../types/ekycLivenessType';
5
5
  import { FaceServiceConfig } from '../types/ekycFaceType';
6
6
  import { SDKEkycResultStringWithEvent, SDKEkycResultWithEvent } from '../types/ekycType';
@@ -76,14 +76,14 @@ export declare class FinosESignModule {
76
76
  */
77
77
  getSdkToken(identity: string, name: string, deviceId: string): Promise<string>;
78
78
  /**
79
- * Open eSign session
80
- * @param accessToken JWT access token (optional if using userEsignModel)
81
- * @param username Optional username
82
- * @param rememberMe Remember session
83
- * @param userEsignModel User info for auto token creation (optional if using accessToken)
84
- * @param privateKeyFilePath Path to private key file in assets (required if using userEsignModel)
79
+ * Open eSign Session
80
+ * @param accessToken Access token (JWT)
81
+ * @param username Username
82
+ * @param rememberMe Remember me flag
83
+ * @param userEsignModel User info model (for auto-token generation)
84
+ * @param privateKeyFilePath Path to private key file (for auto-token generation)
85
85
  */
86
- openSessionId(accessToken?: string, username?: string, rememberMe?: boolean, userEsignModel?: UserEsignModel, privateKeyFilePath?: string): Promise<ESignOpenSessionResult>;
86
+ openSessionId(accessToken: string | null, username: string | null, rememberMe: boolean | null): Promise<ESignOpenSessionResult>;
87
87
  /**
88
88
  * Register device for eSign
89
89
  * @param recoverCode 8-digit recovery code
@@ -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
@@ -266,7 +278,7 @@ export declare class FinosESignModule {
266
278
  }
267
279
  export declare const FinosESign: FinosESignModule;
268
280
  export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
269
- export type { UserEsignModel, ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
281
+ export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
270
282
  export type { LivenessConfig } from '../types/ekycLivenessType';
271
283
  export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
272
284
  export type { FaceServiceConfig } from '../types/ekycFaceType';
@@ -189,17 +189,17 @@ class FinosESignModule {
189
189
  return await this.sdk.getSdkToken(identity, name, deviceId);
190
190
  }
191
191
  /**
192
- * Open eSign session
193
- * @param accessToken JWT access token (optional if using userEsignModel)
194
- * @param username Optional username
195
- * @param rememberMe Remember session
196
- * @param userEsignModel User info for auto token creation (optional if using accessToken)
197
- * @param privateKeyFilePath Path to private key file in assets (required if using userEsignModel)
192
+ * Open eSign Session
193
+ * @param accessToken Access token (JWT)
194
+ * @param username Username
195
+ * @param rememberMe Remember me flag
196
+ * @param userEsignModel User info model (for auto-token generation)
197
+ * @param privateKeyFilePath Path to private key file (for auto-token generation)
198
198
  */
199
- async openSessionId(accessToken, username, rememberMe, userEsignModel, privateKeyFilePath) {
199
+ async openSessionId(accessToken, username, rememberMe) {
200
200
  this.validateSDKReady();
201
201
  // Pass through to SDK - error handling is done in EKYCModule.ts
202
- return await this.sdk.openSessionId(accessToken, username, rememberMe, userEsignModel, privateKeyFilePath);
202
+ return await this.sdk.openSessionId(accessToken, username, rememberMe);
203
203
  }
204
204
  /**
205
205
  * Register device for eSign
@@ -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) {
@@ -480,16 +497,18 @@ const isMethod = (prop) => {
480
497
  prop.startsWith('on') ||
481
498
  prop === 'initialize' ||
482
499
  prop === 'initializeESign' ||
500
+ prop === 'getSdkToken' ||
501
+ prop === 'openSessionId' ||
483
502
  prop === 'sendOtp' ||
484
503
  prop === 'verifyOtp' ||
485
504
  prop === 'resendOtp' ||
486
- prop === 'openSessionId' ||
487
505
  prop === 'registerDevice' ||
488
506
  prop === 'listCerts' ||
489
507
  prop === 'verifyCert' ||
490
508
  prop === 'listSignRequest' ||
491
509
  prop === 'confirmSign' ||
492
510
  prop === 'registerRemoteSigning' ||
511
+ prop === 'registerAndConfirm' ||
493
512
  prop === 'signPdf' ||
494
513
  prop === 'sendConfirmationDocument' ||
495
514
  prop === 'startLiveness' ||
@@ -546,7 +565,7 @@ const createFinosESignStub = () => {
546
565
  'onESignInitSuccess', 'onESignOpenSessionSuccess', 'onESignRegisterDeviceSuccess',
547
566
  'onESignListCertsSuccess', 'onESignVerifyCertSuccess', 'onESignListSignRequestSuccess',
548
567
  'onESignConfirmSignSuccess', 'onESignRegisterRemoteSigningSuccess',
549
- 'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignError',
568
+ 'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignRegisterAndConfirmSuccess', 'onESignError',
550
569
  'onLivenessSuccess', 'onLivenessError', 'onFaceCompareSuccess', 'onFaceCompareError'
551
570
  ];
552
571
  eventListenerMethods.forEach(method => {
@@ -558,9 +577,9 @@ const createFinosESignStub = () => {
558
577
  // Add all other methods
559
578
  const otherMethods = [
560
579
  'initialize', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
561
- 'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'openSessionId',
580
+ 'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'getSdkToken', 'openSessionId',
562
581
  'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
563
- 'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
582
+ 'registerRemoteSigning', 'registerAndConfirm', 'signPdf', 'sendConfirmationDocument',
564
583
  'onResume', 'onPause', 'isSDKReady', 'getSDKInfo'
565
584
  ];
566
585
  otherMethods.forEach(method => {
@@ -1,27 +1,12 @@
1
1
  /**
2
- * User Information Model for eSign
2
+ * eSign Initialize Result
3
3
  */
4
4
  export interface UserEsignModel {
5
- /**
6
- * ID card number (CCCD/CMND)
7
- */
8
5
  cccd: string;
9
- /**
10
- * User name
11
- */
12
6
  name: string;
13
- /**
14
- * Device type (e.g., "Android", "iOS")
15
- */
16
- device: string;
17
- /**
18
- * Device ID
19
- */
20
- deviceId: string;
7
+ device?: string;
8
+ deviceId?: string;
21
9
  }
22
- /**
23
- * eSign Initialize Result
24
- */
25
10
  export interface ESignInitResult {
26
11
  code: string;
27
12
  message: 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.1",
3
+ "version": "1.3.3",
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
- import { UserEsignModel, ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
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 - Custom actions array (LEFT, RIGHT, STRAIGHT). If provided, uses these actions instead of random
193
+ * @param config.customActions - SDKFaceDetectStatus[] enum (LEFT, RIGHT, SMILE, BLINK, ...). Bên sử dụng truyền enum thay 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
  */
@@ -467,41 +468,31 @@ export class FinosEKYCModule {
467
468
  throw error;
468
469
  }
469
470
  }
470
-
471
471
  /**
472
- * Open eSign session
473
- * @param accessToken JWT access token (optional if using userEsignModel)
474
- * @param username Optional username
475
- * @param rememberMe Remember session
476
- * @param userEsignModel User info for auto token creation (optional if using accessToken)
477
- * @param privateKeyFilePath Path to private key file in assets (required if using userEsignModel)
472
+ * Open eSign Session
473
+ * @param accessToken Access token (JWT)
474
+ * @param username Username
475
+ * @param rememberMe Remember me flag
476
+ * @param userEsignModel User info model (for auto-token generation)
477
+ * @param privateKeyFilePath Path to private key file (for auto-token generation)
478
478
  */
479
479
  public async openSessionId(
480
- accessToken?: string,
481
- username?: string,
482
- rememberMe?: boolean,
483
- userEsignModel?: UserEsignModel,
484
- privateKeyFilePath?: string
480
+ accessToken: string | null,
481
+ username: string | null,
482
+ rememberMe: boolean | null
485
483
  ): Promise<ESignOpenSessionResult> {
486
484
  this.validateSDKReady();
487
-
488
- try {
489
- console.log('🔓 Opening eSign session...');
490
- const result = await this.sdk.openSessionId(
491
- accessToken,
492
- username,
493
- rememberMe,
494
- userEsignModel,
495
- privateKeyFilePath
496
- );
497
- console.log('✅ eSign session opened successfully');
498
- return result;
499
- } catch (error) {
500
- console.error('❌ eSign session open failed:', error);
501
- throw error;
502
- }
485
+ // Pass through to SDK - error handling is done in EKYCModule.ts
486
+ return await this.sdk.openSessionId(
487
+ accessToken,
488
+ username,
489
+ rememberMe
490
+ );
503
491
  }
504
492
 
493
+
494
+
495
+
505
496
  /**
506
497
  * Register device for eSign
507
498
  * @param recoverCode 8-digit recovery code
@@ -731,7 +722,7 @@ export class FinosEKYCModule {
731
722
  /**
732
723
  * Start eKYC UI with flow (like MainActivity.kt)
733
724
  * @param appKey Main app key
734
- * @param flowSDK Array of SDK types
725
+ * @param flowSDK Array of SDKFlowType enum (OCR, NFC, LIVENESS) – bên sử dụng truyền enum
735
726
  * @param language Language code (vi/en)
736
727
  * @param transactionId Transaction ID
737
728
  * @param appKeyConfig Optional app key configuration
@@ -740,7 +731,7 @@ export class FinosEKYCModule {
740
731
  */
741
732
  public async startEkycUI(
742
733
  appKey: string,
743
- flowSDK: string[],
734
+ flowSDK: SDKFlowType[],
744
735
  language: string,
745
736
  transactionId: string,
746
737
  appKeyConfig: {
@@ -756,6 +747,13 @@ export class FinosEKYCModule {
756
747
  countMaxRetry?: number;
757
748
  language?: string;
758
749
  switchFrontCamera?: boolean;
750
+ /** LivenessConfig – SDKeKYCActivity (157-169) */
751
+ isActiveLiveness?: boolean;
752
+ autoCapture?: boolean;
753
+ forceCaptureTimeout?: number; // seconds, native uses ms
754
+ /** Bên sử dụng truyền enum – SDKFaceDetectStatus[] thay vì string[] */
755
+ customActions?: SDKFaceDetectStatus[];
756
+ activeActionCount?: number;
759
757
  },
760
758
  styleConfig?: {
761
759
  textSize?: number;
@@ -808,7 +806,7 @@ export class FinosEKYCModule {
808
806
 
809
807
  const result = await this.sdk.startEkycUI(
810
808
  appKey,
811
- flowSDK,
809
+ flowToStrings(flowSDK),
812
810
  language,
813
811
  transactionId,
814
812
  appKeyConfig,
@@ -867,6 +865,7 @@ const isMethod = (prop: string | symbol): boolean => {
867
865
  return typeof prototype[prop] === 'function' ||
868
866
  prop.startsWith('on') ||
869
867
  prop === 'initialize' ||
868
+ prop === 'openSessionId' ||
870
869
  prop === 'startEkycUI' ||
871
870
  prop === 'startNfcScan' ||
872
871
  prop === 'checkC06' ||
@@ -1003,7 +1002,7 @@ export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
1003
1002
  export type { FaceServiceConfig } from '../types/ekycFaceType';
1004
1003
  export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent } from '../types/ekycType';
1005
1004
  export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
1006
- export type { UserEsignModel, ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
1005
+ export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
1007
1006
 
1008
1007
  // Export constants
1009
1008
  export { SDK_VERSION, SDK_NAME };