@finos_sdk/sdk-ekyc 1.2.9 → 1.3.2

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.
@@ -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.FinosESign = exports.FinosESignModule = void 0;
26
+ exports.SDK_NAME = exports.SDK_VERSION = exports.SDKFaceDetectStatus = exports.FinosESign = exports.FinosESignModule = void 0;
27
27
  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; } });
@@ -116,16 +116,8 @@ class FinosESignModule {
116
116
  */
117
117
  async sendOtp(config) {
118
118
  this.validateSDKReady();
119
- try {
120
- console.log('📱 Sending SMS OTP...');
121
- const result = await this.sdk.sendOtp(config);
122
- console.log('✅ SMS OTP sent successfully');
123
- return result;
124
- }
125
- catch (error) {
126
- console.error('❌ SMS OTP send failed:', error);
127
- throw error;
128
- }
119
+ // Pass through to SDK - error handling is done in EKYCModule.ts
120
+ return await this.sdk.sendOtp(config);
129
121
  }
130
122
  /**
131
123
  * Verify SMS OTP
@@ -134,16 +126,8 @@ class FinosESignModule {
134
126
  */
135
127
  async verifyOtp(config, otpCode) {
136
128
  this.validateSDKReady();
137
- try {
138
- console.log('🔐 Verifying SMS OTP...');
139
- const result = await this.sdk.verifyOtp(config, otpCode);
140
- console.log('✅ SMS OTP verified successfully');
141
- return result;
142
- }
143
- catch (error) {
144
- console.error('❌ SMS OTP verification failed:', error);
145
- throw error;
146
- }
129
+ // Pass through to SDK - error handling is done in EKYCModule.ts
130
+ return await this.sdk.verifyOtp(config, otpCode);
147
131
  }
148
132
  /**
149
133
  * Resend SMS OTP
@@ -151,16 +135,8 @@ class FinosESignModule {
151
135
  */
152
136
  async resendOtp(config) {
153
137
  this.validateSDKReady();
154
- try {
155
- console.log('📱 Resending SMS OTP...');
156
- const result = await this.sdk.resendOtp(config);
157
- console.log('✅ SMS OTP resent successfully');
158
- return result;
159
- }
160
- catch (error) {
161
- console.error('❌ SMS OTP resend failed:', error);
162
- throw error;
163
- }
138
+ // Pass through to SDK - error handling is done in EKYCModule.ts
139
+ return await this.sdk.resendOtp(config);
164
140
  }
165
141
  // SMS OTP Event Listeners
166
142
  onSmsOtpSendSuccess(callback) {
@@ -194,40 +170,36 @@ class FinosESignModule {
194
170
  // ==================== eSign Methods ====================
195
171
  /**
196
172
  * Initialize eSign SDK
173
+ * @param finosToken Optional access token (Client Credentials)
197
174
  */
198
- async initializeESign() {
175
+ async initializeESign(finosToken) {
199
176
  this.validateSDKReady();
200
- try {
201
- console.log('🔐 Initializing eSign SDK...');
202
- const result = await this.sdk.initializeESign();
203
- console.log('✅ eSign SDK initialized successfully');
204
- return result;
205
- }
206
- catch (error) {
207
- console.error('❌ eSign initialization failed:', error);
208
- throw error;
209
- }
177
+ // Pass through to SDK - error handling is done in EKYCModule.ts
178
+ return await this.sdk.initializeESign(finosToken);
210
179
  }
211
180
  /**
212
- * Open eSign session
213
- * @param accessToken JWT access token (optional if using userEsignModel)
214
- * @param username Optional username
215
- * @param rememberMe Remember session
216
- * @param userEsignModel User info for auto token creation (optional if using accessToken)
217
- * @param privateKeyFilePath Path to private key file in assets (required if using userEsignModel)
181
+ * Get SDK Token for Session
182
+ * @param identity User Identity (CCCD/CMND)
183
+ * @param name User Name
184
+ * @param deviceId Device ID
218
185
  */
219
- async openSessionId(accessToken, username, rememberMe, userEsignModel, privateKeyFilePath) {
186
+ async getSdkToken(identity, name, deviceId) {
220
187
  this.validateSDKReady();
221
- try {
222
- console.log('🔓 Opening eSign session...');
223
- const result = await this.sdk.openSessionId(accessToken, username, rememberMe, userEsignModel, privateKeyFilePath);
224
- console.log('✅ eSign session opened successfully');
225
- return result;
226
- }
227
- catch (error) {
228
- console.error('❌ eSign session open failed:', error);
229
- throw error;
230
- }
188
+ // Pass through to SDK - error handling is done in EKYCModule.ts
189
+ return await this.sdk.getSdkToken(identity, name, deviceId);
190
+ }
191
+ /**
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
+ */
199
+ async openSessionId(accessToken, username, rememberMe) {
200
+ this.validateSDKReady();
201
+ // Pass through to SDK - error handling is done in EKYCModule.ts
202
+ return await this.sdk.openSessionId(accessToken, username, rememberMe);
231
203
  }
232
204
  /**
233
205
  * Register device for eSign
@@ -237,16 +209,8 @@ class FinosESignModule {
237
209
  */
238
210
  async registerDevice(recoverCode, pinCode, fcmToken) {
239
211
  this.validateSDKReady();
240
- try {
241
- console.log('📱 Registering eSign device...');
242
- const result = await this.sdk.registerDevice(recoverCode, pinCode, fcmToken);
243
- console.log('✅ eSign device registered successfully');
244
- return result;
245
- }
246
- catch (error) {
247
- console.error('❌ eSign device registration failed:', error);
248
- throw error;
249
- }
212
+ // Pass through to SDK - error handling is done in EKYCModule.ts
213
+ return await this.sdk.registerDevice(recoverCode, pinCode, fcmToken);
250
214
  }
251
215
  /**
252
216
  * List eSign certificates
@@ -255,16 +219,8 @@ class FinosESignModule {
255
219
  */
256
220
  async listCerts(pageNumber = 1, pageSize = 10) {
257
221
  this.validateSDKReady();
258
- try {
259
- console.log('📋 Listing eSign certificates...');
260
- const result = await this.sdk.listCerts(pageNumber, pageSize);
261
- console.log(`✅ Found ${result.certs.length} certificates`);
262
- return result;
263
- }
264
- catch (error) {
265
- console.error('❌ eSign list certificates failed:', error);
266
- throw error;
267
- }
222
+ // Pass through to SDK - error handling is done in EKYCModule.ts
223
+ return await this.sdk.listCerts(pageNumber, pageSize);
268
224
  }
269
225
  /**
270
226
  * Verify eSign certificate
@@ -272,16 +228,8 @@ class FinosESignModule {
272
228
  */
273
229
  async verifyCert(serial) {
274
230
  this.validateSDKReady();
275
- try {
276
- console.log('✅ Verifying eSign certificate...');
277
- const result = await this.sdk.verifyCert(serial);
278
- console.log('✅ eSign certificate verified successfully');
279
- return result;
280
- }
281
- catch (error) {
282
- console.error('❌ eSign certificate verification failed:', error);
283
- throw error;
284
- }
231
+ // Pass through to SDK - error handling is done in EKYCModule.ts
232
+ return await this.sdk.verifyCert(serial);
285
233
  }
286
234
  /**
287
235
  * List eSign sign requests
@@ -290,16 +238,8 @@ class FinosESignModule {
290
238
  */
291
239
  async listSignRequest(pageNumber = 1, pageSize = 10) {
292
240
  this.validateSDKReady();
293
- try {
294
- console.log('📋 Listing eSign sign requests...');
295
- const result = await this.sdk.listSignRequest(pageNumber, pageSize);
296
- console.log(`✅ Found ${result.requests.length} sign requests`);
297
- return result;
298
- }
299
- catch (error) {
300
- console.error('❌ eSign list sign requests failed:', error);
301
- throw error;
302
- }
241
+ // Pass through to SDK - error handling is done in EKYCModule.ts
242
+ return await this.sdk.listSignRequest(pageNumber, pageSize);
303
243
  }
304
244
  /**
305
245
  * Confirm eSign signature
@@ -311,88 +251,35 @@ class FinosESignModule {
311
251
  */
312
252
  async confirmSign(signRequestId, pinCode, authId, authData, confirm = true) {
313
253
  this.validateSDKReady();
314
- try {
315
- console.log('✍️ Confirming eSign signature...');
316
- const result = await this.sdk.confirmSign(signRequestId, pinCode, authId, authData, confirm);
317
- console.log('✅ eSign signature confirmed successfully');
318
- return result;
319
- }
320
- catch (error) {
321
- console.error('❌ eSign signature confirmation failed:', error);
322
- throw error;
323
- }
324
- }
325
- /**
326
- * Authenticate with eSign
327
- * @param username eSign username
328
- * @param password eSign password
329
- */
330
- async authenticate(username, password) {
331
- this.validateSDKReady();
332
- try {
333
- console.log('🔐 Authenticating with eSign...');
334
- const result = await this.sdk.authenticate(username, password);
335
- console.log('✅ eSign authentication successful');
336
- return result;
337
- }
338
- catch (error) {
339
- console.error('❌ eSign authentication failed:', error);
340
- throw error;
341
- }
254
+ // Pass through to SDK - error handling is done in EKYCModule.ts
255
+ return await this.sdk.confirmSign(signRequestId, pinCode, authId, authData, confirm);
342
256
  }
343
257
  /**
344
258
  * Register remote signing certificate
345
- * @param accessToken JWT access token
346
259
  * @param requestJson JSON request body
347
260
  */
348
- async registerRemoteSigning(accessToken, requestJson) {
261
+ async registerRemoteSigning(requestJson) {
349
262
  this.validateSDKReady();
350
- try {
351
- console.log('📝 Registering remote signing certificate...');
352
- const result = await this.sdk.registerRemoteSigning(accessToken, requestJson);
353
- console.log('✅ Remote signing certificate registered successfully');
354
- return result;
355
- }
356
- catch (error) {
357
- console.error('❌ Remote signing certificate registration failed:', error);
358
- throw error;
359
- }
263
+ // Pass through to SDK - error handling is done in EKYCModule.ts
264
+ return await this.sdk.registerRemoteSigning(requestJson);
360
265
  }
361
266
  /**
362
267
  * Sign PDF document
363
- * @param accessToken JWT access token
364
268
  * @param requestJson JSON request body
365
269
  */
366
- async signPdf(accessToken, requestJson) {
270
+ async signPdf(requestJson) {
367
271
  this.validateSDKReady();
368
- try {
369
- console.log('📄 Signing PDF document...');
370
- const result = await this.sdk.signPdf(accessToken, requestJson);
371
- console.log('✅ PDF document signed successfully');
372
- return result;
373
- }
374
- catch (error) {
375
- console.error('❌ PDF document signing failed:', error);
376
- throw error;
377
- }
272
+ // Pass through to SDK - error handling is done in EKYCModule.ts
273
+ return await this.sdk.signPdf(requestJson);
378
274
  }
379
275
  /**
380
276
  * Send confirmation document
381
- * @param accessToken JWT access token
382
277
  * @param requestJson JSON string containing request data
383
278
  */
384
- async sendConfirmationDocument(accessToken, requestJson) {
279
+ async sendConfirmationDocument(requestJson) {
385
280
  this.validateSDKReady();
386
- try {
387
- console.log('📧 Sending confirmation document...');
388
- const result = await this.sdk.sendConfirmationDocument(accessToken, requestJson);
389
- console.log('✅ Confirmation document sent successfully');
390
- return result;
391
- }
392
- catch (error) {
393
- console.error('❌ Confirmation document sending failed:', error);
394
- throw error;
395
- }
281
+ // Pass through to SDK - error handling is done in EKYCModule.ts
282
+ return await this.sdk.sendConfirmationDocument(requestJson);
396
283
  }
397
284
  /**
398
285
  * Remove all event listeners
@@ -451,13 +338,6 @@ class FinosESignModule {
451
338
  }
452
339
  return listener;
453
340
  }
454
- onESignAuthenticateSuccess(callback) {
455
- const listener = this.sdk.onESignAuthenticateSuccess(callback);
456
- if (!listener) {
457
- console.warn('⚠️ onESignAuthenticateSuccess: Event emitter not ready.');
458
- }
459
- return listener;
460
- }
461
341
  onESignRegisterRemoteSigningSuccess(callback) {
462
342
  const listener = this.sdk.onESignRegisterRemoteSigningSuccess(callback);
463
343
  if (!listener) {
@@ -489,23 +369,18 @@ class FinosESignModule {
489
369
  // ==================== Liveness Methods ====================
490
370
  /**
491
371
  * Start liveness detection
492
- * @param config Liveness configuration (includes switchFrontCamera for camera control)
372
+ * @param config Liveness configuration
373
+ * @param config.isActiveLiveness - Enable active liveness detection (default: false)
374
+ * @param config.autoCapture - Enable auto capture (default: true)
375
+ * @param config.isShowCameraFont - Show camera font (default: true)
376
+ * @param config.customActions - Custom actions array (LEFT, RIGHT, STRAIGHT). If provided, uses these actions instead of random
377
+ * @param config.activeActionCount - Number of random actions (1-10), only used when customActions is null (default: 2)
378
+ * @param config.switchFrontCamera - Use front camera (default: false)
493
379
  */
494
380
  async startLiveness(config) {
495
381
  this.validateSDKReady();
496
- try {
497
- console.log('👁️ Starting liveness detection...');
498
- if (config.switchFrontCamera !== undefined) {
499
- console.log('📷 Front camera setting:', config.switchFrontCamera ? 'ON' : 'OFF');
500
- }
501
- const result = await this.sdk.startLiveness(config);
502
- console.log('✅ Liveness detection completed:', result.event);
503
- return result;
504
- }
505
- catch (error) {
506
- console.error('❌ Liveness detection failed:', error);
507
- throw error;
508
- }
382
+ // Pass through to SDK - error handling is done in EKYCModule.ts
383
+ return await this.sdk.startLiveness(config);
509
384
  }
510
385
  // Liveness Event Listeners
511
386
  onLivenessSuccess(callback) {
@@ -521,16 +396,8 @@ class FinosESignModule {
521
396
  */
522
397
  async startFaceCompare(config) {
523
398
  this.validateSDKReady();
524
- try {
525
- console.log('👤 Starting face comparison...');
526
- const result = await this.sdk.startFaceCompare(config);
527
- console.log('✅ Face comparison completed:', result.event);
528
- return result;
529
- }
530
- catch (error) {
531
- console.error('❌ Face comparison failed:', error);
532
- throw error;
533
- }
399
+ // Pass through to SDK - error handling is done in EKYCModule.ts
400
+ return await this.sdk.startFaceCompare(config);
534
401
  }
535
402
  // Face Compare Event Listeners
536
403
  onFaceCompareSuccess(callback) {
@@ -562,31 +429,17 @@ class FinosESignModule {
562
429
  if (flowSDK.length === 0) {
563
430
  throw new Error('flowSDK must contain at least one SDK type (LIVENESS or FACE)');
564
431
  }
565
- try {
566
- console.log('🚀 Starting eKYC UI with flow:', flowSDK);
567
- console.log('🔧 OptionConfig:', optionConfig);
568
- if ((optionConfig === null || optionConfig === void 0 ? void 0 : optionConfig.switchFrontCamera) !== undefined) {
569
- console.log('📷 Front camera setting:', optionConfig.switchFrontCamera ? 'ON' : 'OFF');
570
- }
571
- console.log('🔑 AppKeyConfig:', appKeyConfig);
572
- console.log('🎨 StyleConfig:', styleConfig);
573
- // Create full appKeyConfig with empty values for excluded modules
574
- const fullAppKeyConfig = {
575
- appKey: appKeyConfig.appKey,
576
- appKeyNfc: '',
577
- appKeyOcr: '',
578
- appKeyLiveness: appKeyConfig.appKeyLiveness,
579
- appKeyC06: '',
580
- appKeyFaceService: appKeyConfig.appKeyFaceService,
581
- };
582
- const result = await this.sdk.startEkycUI(appKey, flowSDK, language, transactionId, fullAppKeyConfig, optionConfig, styleConfig);
583
- console.log('✅ eKYC UI started successfully');
584
- return result;
585
- }
586
- catch (error) {
587
- console.error('❌ eKYC UI failed:', error);
588
- throw error;
589
- }
432
+ // Create full appKeyConfig with empty values for excluded modules
433
+ const fullAppKeyConfig = {
434
+ appKey: appKeyConfig.appKey,
435
+ appKeyNfc: '',
436
+ appKeyOcr: '',
437
+ appKeyLiveness: appKeyConfig.appKeyLiveness,
438
+ appKeyC06: '',
439
+ appKeyFaceService: appKeyConfig.appKeyFaceService,
440
+ };
441
+ // Pass through to SDK - error handling is done in EKYCModule.ts
442
+ return await this.sdk.startEkycUI(appKey, flowSDK, language, transactionId, fullAppKeyConfig, optionConfig, styleConfig);
590
443
  }
591
444
  // Private validation methods
592
445
  validateSDKReady() {
@@ -627,16 +480,16 @@ const isMethod = (prop) => {
627
480
  prop.startsWith('on') ||
628
481
  prop === 'initialize' ||
629
482
  prop === 'initializeESign' ||
483
+ prop === 'getSdkToken' ||
484
+ prop === 'openSessionId' ||
630
485
  prop === 'sendOtp' ||
631
486
  prop === 'verifyOtp' ||
632
487
  prop === 'resendOtp' ||
633
- prop === 'openSessionId' ||
634
488
  prop === 'registerDevice' ||
635
489
  prop === 'listCerts' ||
636
490
  prop === 'verifyCert' ||
637
491
  prop === 'listSignRequest' ||
638
492
  prop === 'confirmSign' ||
639
- prop === 'authenticate' ||
640
493
  prop === 'registerRemoteSigning' ||
641
494
  prop === 'signPdf' ||
642
495
  prop === 'sendConfirmationDocument' ||
@@ -693,7 +546,7 @@ const createFinosESignStub = () => {
693
546
  'onSmsOtpSendSuccess', 'onSmsOtpVerifySuccess', 'onSmsOtpResendSuccess', 'onSmsOtpError',
694
547
  'onESignInitSuccess', 'onESignOpenSessionSuccess', 'onESignRegisterDeviceSuccess',
695
548
  'onESignListCertsSuccess', 'onESignVerifyCertSuccess', 'onESignListSignRequestSuccess',
696
- 'onESignConfirmSignSuccess', 'onESignAuthenticateSuccess', 'onESignRegisterRemoteSigningSuccess',
549
+ 'onESignConfirmSignSuccess', 'onESignRegisterRemoteSigningSuccess',
697
550
  'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignError',
698
551
  'onLivenessSuccess', 'onLivenessError', 'onFaceCompareSuccess', 'onFaceCompareError'
699
552
  ];
@@ -705,10 +558,11 @@ const createFinosESignStub = () => {
705
558
  });
706
559
  // Add all other methods
707
560
  const otherMethods = [
708
- 'initialize', 'initializeESign', 'sendOtp', 'verifyOtp', 'resendOtp',
709
- 'openSessionId', 'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest',
710
- 'confirmSign', 'authenticate', 'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
711
- 'startLiveness', 'startFaceCompare', 'startEkycUI', 'isSDKReady', 'getSDKInfo'
561
+ 'initialize', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
562
+ 'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'getSdkToken', 'openSessionId',
563
+ 'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
564
+ 'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
565
+ 'onResume', 'onPause', 'isSDKReady', 'getSDKInfo'
712
566
  ];
713
567
  otherMethods.forEach(method => {
714
568
  stub[method] = async (...args) => {
@@ -748,5 +602,7 @@ const createFinosESignWrapper = () => {
748
602
  };
749
603
  // Export - this ensures FinosESign is never undefined
750
604
  exports.FinosESign = createFinosESignWrapper();
605
+ var ekycLivenessType_1 = require("../types/ekycLivenessType");
606
+ Object.defineProperty(exports, "SDKFaceDetectStatus", { enumerable: true, get: function () { return ekycLivenessType_1.SDKFaceDetectStatus; } });
751
607
  // Default export
752
608
  exports.default = exports.FinosESign;
@@ -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;
@@ -1,11 +1,20 @@
1
1
  import { CheckSummaryResponse } from "./ekycOCRType";
2
+ export declare enum SDKFaceDetectStatus {
3
+ LEFT = "LEFT",
4
+ RIGHT = "RIGHT",
5
+ STRAIGHT = "STRAIGHT"
6
+ }
2
7
  export interface LivenessConfig {
3
8
  appKey: string;
4
9
  transactionId?: string;
5
- usingRandomAction: boolean;
6
- isStraight: boolean;
7
10
  selfieImage: string;
8
11
  switchFrontCamera?: boolean;
12
+ isActiveLiveness?: boolean;
13
+ autoCapture?: boolean;
14
+ isShowCameraFont?: boolean;
15
+ customActions?: SDKFaceDetectStatus[];
16
+ activeActionCount?: number;
17
+ forceCaptureTimeout?: number;
9
18
  }
10
19
  export interface CheckLivenessResponse {
11
20
  metadata?: Metadata;
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SDKFaceDetectStatus = void 0;
4
+ var SDKFaceDetectStatus;
5
+ (function (SDKFaceDetectStatus) {
6
+ SDKFaceDetectStatus["LEFT"] = "LEFT";
7
+ SDKFaceDetectStatus["RIGHT"] = "RIGHT";
8
+ SDKFaceDetectStatus["STRAIGHT"] = "STRAIGHT";
9
+ })(SDKFaceDetectStatus = exports.SDKFaceDetectStatus || (exports.SDKFaceDetectStatus = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos_sdk/sdk-ekyc",
3
- "version": "1.2.9",
3
+ "version": "1.3.2",
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",
@@ -94,4 +94,4 @@
94
94
  "engines": {
95
95
  "node": ">=18"
96
96
  }
97
- }
97
+ }