@finos_sdk/sdk-ekyc 1.2.8 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/android/build.gradle +1 -1
- package/android/src/main/java/finos/sdk/ekyc/EKYCModule.kt +220 -119
- package/dist/EKYCModule.d.ts +9 -8
- package/dist/EKYCModule.js +89 -40
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/package.json +1 -1
- package/dist/src/modules/FinosEKYCModule.d.ts +20 -16
- package/dist/src/modules/FinosEKYCModule.js +49 -43
- package/dist/src/modules/FinosESignModule.d.ts +21 -16
- package/dist/src/modules/FinosESignModule.js +73 -218
- package/dist/src/types/ekycLivenessType.d.ts +11 -2
- package/dist/src/types/ekycLivenessType.js +7 -0
- package/package.json +2 -2
- package/src/modules/FinosEKYCModule.ts +89 -86
- package/src/modules/FinosESignModule.ts +117 -266
- package/src/modules/README.md +21 -2
- package/src/types/ekycLivenessType.ts +16 -2
- package/dist/finos_sdk-sdk-ekyc-1.2.8.tgz +0 -0
|
@@ -94,7 +94,7 @@ export class FinosESignModule {
|
|
|
94
94
|
this.isInitialized = true;
|
|
95
95
|
return 'SDK already initialized (Koin Application started)';
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
console.error('❌ Failed to initialize Finos eSign SDK:', error);
|
|
99
99
|
throw new Error(`SDK initialization failed: ${error}`);
|
|
100
100
|
}
|
|
@@ -115,16 +115,8 @@ export class FinosESignModule {
|
|
|
115
115
|
*/
|
|
116
116
|
public async sendOtp(config: SmsOtpConfig): Promise<SmsOtpResult> {
|
|
117
117
|
this.validateSDKReady();
|
|
118
|
-
|
|
119
|
-
|
|
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
|
-
} catch (error) {
|
|
125
|
-
console.error('❌ SMS OTP send failed:', error);
|
|
126
|
-
throw error;
|
|
127
|
-
}
|
|
118
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
119
|
+
return await this.sdk.sendOtp(config);
|
|
128
120
|
}
|
|
129
121
|
|
|
130
122
|
/**
|
|
@@ -134,16 +126,8 @@ export class FinosESignModule {
|
|
|
134
126
|
*/
|
|
135
127
|
public async verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<SmsOtpResult> {
|
|
136
128
|
this.validateSDKReady();
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
console.log('🔐 Verifying SMS OTP...');
|
|
140
|
-
const result = await this.sdk.verifyOtp(config, otpCode);
|
|
141
|
-
console.log('✅ SMS OTP verified successfully');
|
|
142
|
-
return result;
|
|
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
|
/**
|
|
@@ -152,16 +136,8 @@ export class FinosESignModule {
|
|
|
152
136
|
*/
|
|
153
137
|
public async resendOtp(config: SmsOtpConfig): Promise<SmsOtpResult> {
|
|
154
138
|
this.validateSDKReady();
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
console.log('📱 Resending SMS OTP...');
|
|
158
|
-
const result = await this.sdk.resendOtp(config);
|
|
159
|
-
console.log('✅ SMS OTP resent successfully');
|
|
160
|
-
return result;
|
|
161
|
-
} catch (error) {
|
|
162
|
-
console.error('❌ SMS OTP resend failed:', error);
|
|
163
|
-
throw error;
|
|
164
|
-
}
|
|
139
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
140
|
+
return await this.sdk.resendOtp(config);
|
|
165
141
|
}
|
|
166
142
|
|
|
167
143
|
// SMS OTP Event Listeners
|
|
@@ -201,19 +177,24 @@ export class FinosESignModule {
|
|
|
201
177
|
|
|
202
178
|
/**
|
|
203
179
|
* Initialize eSign SDK
|
|
180
|
+
* @param finosToken Optional access token (Client Credentials)
|
|
204
181
|
*/
|
|
205
|
-
public async initializeESign(): Promise<ESignInitResult> {
|
|
182
|
+
public async initializeESign(finosToken?: string): Promise<ESignInitResult> {
|
|
206
183
|
this.validateSDKReady();
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
184
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
185
|
+
return await this.sdk.initializeESign(finosToken);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Get SDK Token for Session
|
|
190
|
+
* @param identity User Identity (CCCD/CMND)
|
|
191
|
+
* @param name User Name
|
|
192
|
+
* @param deviceId Device ID
|
|
193
|
+
*/
|
|
194
|
+
public async getSdkToken(identity: string, name: string, deviceId: string): Promise<string> {
|
|
195
|
+
this.validateSDKReady();
|
|
196
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
197
|
+
return await this.sdk.getSdkToken(identity, name, deviceId);
|
|
217
198
|
}
|
|
218
199
|
|
|
219
200
|
/**
|
|
@@ -232,22 +213,14 @@ export class FinosESignModule {
|
|
|
232
213
|
privateKeyFilePath?: string
|
|
233
214
|
): Promise<ESignOpenSessionResult> {
|
|
234
215
|
this.validateSDKReady();
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
privateKeyFilePath
|
|
244
|
-
);
|
|
245
|
-
console.log('✅ eSign session opened successfully');
|
|
246
|
-
return result;
|
|
247
|
-
} catch (error) {
|
|
248
|
-
console.error('❌ eSign session open failed:', error);
|
|
249
|
-
throw error;
|
|
250
|
-
}
|
|
216
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
217
|
+
return await this.sdk.openSessionId(
|
|
218
|
+
accessToken,
|
|
219
|
+
username,
|
|
220
|
+
rememberMe,
|
|
221
|
+
userEsignModel,
|
|
222
|
+
privateKeyFilePath
|
|
223
|
+
);
|
|
251
224
|
}
|
|
252
225
|
|
|
253
226
|
/**
|
|
@@ -262,16 +235,8 @@ export class FinosESignModule {
|
|
|
262
235
|
fcmToken?: string
|
|
263
236
|
): Promise<{ code: string; message: string }> {
|
|
264
237
|
this.validateSDKReady();
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
console.log('📱 Registering eSign device...');
|
|
268
|
-
const result = await this.sdk.registerDevice(recoverCode, pinCode, fcmToken);
|
|
269
|
-
console.log('✅ eSign device registered successfully');
|
|
270
|
-
return result;
|
|
271
|
-
} catch (error) {
|
|
272
|
-
console.error('❌ eSign device registration failed:', error);
|
|
273
|
-
throw error;
|
|
274
|
-
}
|
|
238
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
239
|
+
return await this.sdk.registerDevice(recoverCode, pinCode, fcmToken);
|
|
275
240
|
}
|
|
276
241
|
|
|
277
242
|
/**
|
|
@@ -284,16 +249,8 @@ export class FinosESignModule {
|
|
|
284
249
|
pageSize: number = 10
|
|
285
250
|
): Promise<{ certs: ESignCertificate[] }> {
|
|
286
251
|
this.validateSDKReady();
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
console.log('📋 Listing eSign certificates...');
|
|
290
|
-
const result = await this.sdk.listCerts(pageNumber, pageSize);
|
|
291
|
-
console.log(`✅ Found ${result.certs.length} certificates`);
|
|
292
|
-
return result;
|
|
293
|
-
} catch (error) {
|
|
294
|
-
console.error('❌ eSign list certificates failed:', error);
|
|
295
|
-
throw error;
|
|
296
|
-
}
|
|
252
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
253
|
+
return await this.sdk.listCerts(pageNumber, pageSize);
|
|
297
254
|
}
|
|
298
255
|
|
|
299
256
|
/**
|
|
@@ -302,16 +259,8 @@ export class FinosESignModule {
|
|
|
302
259
|
*/
|
|
303
260
|
public async verifyCert(serial: string): Promise<{ code: string; message: string }> {
|
|
304
261
|
this.validateSDKReady();
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
console.log('✅ Verifying eSign certificate...');
|
|
308
|
-
const result = await this.sdk.verifyCert(serial);
|
|
309
|
-
console.log('✅ eSign certificate verified successfully');
|
|
310
|
-
return result;
|
|
311
|
-
} catch (error) {
|
|
312
|
-
console.error('❌ eSign certificate verification failed:', error);
|
|
313
|
-
throw error;
|
|
314
|
-
}
|
|
262
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
263
|
+
return await this.sdk.verifyCert(serial);
|
|
315
264
|
}
|
|
316
265
|
|
|
317
266
|
/**
|
|
@@ -324,16 +273,8 @@ export class FinosESignModule {
|
|
|
324
273
|
pageSize: number = 10
|
|
325
274
|
): Promise<{ requests: ESignSignRequest[] }> {
|
|
326
275
|
this.validateSDKReady();
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
console.log('📋 Listing eSign sign requests...');
|
|
330
|
-
const result = await this.sdk.listSignRequest(pageNumber, pageSize);
|
|
331
|
-
console.log(`✅ Found ${result.requests.length} sign requests`);
|
|
332
|
-
return result;
|
|
333
|
-
} catch (error) {
|
|
334
|
-
console.error('❌ eSign list sign requests failed:', error);
|
|
335
|
-
throw error;
|
|
336
|
-
}
|
|
276
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
277
|
+
return await this.sdk.listSignRequest(pageNumber, pageSize);
|
|
337
278
|
}
|
|
338
279
|
|
|
339
280
|
/**
|
|
@@ -352,104 +293,46 @@ export class FinosESignModule {
|
|
|
352
293
|
confirm: boolean = true
|
|
353
294
|
): Promise<{ code: string; message: string }> {
|
|
354
295
|
this.validateSDKReady();
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
console.log('✍️ Confirming eSign signature...');
|
|
358
|
-
const result = await this.sdk.confirmSign(signRequestId, pinCode, authId, authData, confirm);
|
|
359
|
-
console.log('✅ eSign signature confirmed successfully');
|
|
360
|
-
return result;
|
|
361
|
-
} catch (error) {
|
|
362
|
-
console.error('❌ eSign signature confirmation failed:', error);
|
|
363
|
-
throw error;
|
|
364
|
-
}
|
|
296
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
297
|
+
return await this.sdk.confirmSign(signRequestId, pinCode, authId, authData, confirm);
|
|
365
298
|
}
|
|
366
299
|
|
|
367
|
-
|
|
368
|
-
* Authenticate with eSign
|
|
369
|
-
* @param username eSign username
|
|
370
|
-
* @param password eSign password
|
|
371
|
-
*/
|
|
372
|
-
public async authenticate(
|
|
373
|
-
username: string,
|
|
374
|
-
password: string
|
|
375
|
-
): Promise<ESignAuthenticateResult> {
|
|
376
|
-
this.validateSDKReady();
|
|
377
|
-
|
|
378
|
-
try {
|
|
379
|
-
console.log('🔐 Authenticating with eSign...');
|
|
380
|
-
const result = await this.sdk.authenticate(username, password);
|
|
381
|
-
console.log('✅ eSign authentication successful');
|
|
382
|
-
return result;
|
|
383
|
-
} catch (error) {
|
|
384
|
-
console.error('❌ eSign authentication failed:', error);
|
|
385
|
-
throw error;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
300
|
+
|
|
388
301
|
|
|
389
302
|
/**
|
|
390
303
|
* Register remote signing certificate
|
|
391
|
-
* @param accessToken JWT access token
|
|
392
304
|
* @param requestJson JSON request body
|
|
393
305
|
*/
|
|
394
306
|
public async registerRemoteSigning(
|
|
395
|
-
accessToken: string,
|
|
396
307
|
requestJson: string
|
|
397
308
|
): Promise<{ response: string }> {
|
|
398
309
|
this.validateSDKReady();
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
console.log('📝 Registering remote signing certificate...');
|
|
402
|
-
const result = await this.sdk.registerRemoteSigning(accessToken, requestJson);
|
|
403
|
-
console.log('✅ Remote signing certificate registered successfully');
|
|
404
|
-
return result;
|
|
405
|
-
} catch (error) {
|
|
406
|
-
console.error('❌ Remote signing certificate registration failed:', error);
|
|
407
|
-
throw error;
|
|
408
|
-
}
|
|
310
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
311
|
+
return await this.sdk.registerRemoteSigning(requestJson);
|
|
409
312
|
}
|
|
410
313
|
|
|
411
314
|
/**
|
|
412
315
|
* Sign PDF document
|
|
413
|
-
* @param accessToken JWT access token
|
|
414
316
|
* @param requestJson JSON request body
|
|
415
317
|
*/
|
|
416
318
|
public async signPdf(
|
|
417
|
-
accessToken: string,
|
|
418
319
|
requestJson: string
|
|
419
320
|
): Promise<{ response: string }> {
|
|
420
321
|
this.validateSDKReady();
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
console.log('📄 Signing PDF document...');
|
|
424
|
-
const result = await this.sdk.signPdf(accessToken, requestJson);
|
|
425
|
-
console.log('✅ PDF document signed successfully');
|
|
426
|
-
return result;
|
|
427
|
-
} catch (error) {
|
|
428
|
-
console.error('❌ PDF document signing failed:', error);
|
|
429
|
-
throw error;
|
|
430
|
-
}
|
|
322
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
323
|
+
return await this.sdk.signPdf(requestJson);
|
|
431
324
|
}
|
|
432
325
|
|
|
433
326
|
/**
|
|
434
327
|
* Send confirmation document
|
|
435
|
-
* @param accessToken JWT access token
|
|
436
328
|
* @param requestJson JSON string containing request data
|
|
437
329
|
*/
|
|
438
330
|
public async sendConfirmationDocument(
|
|
439
|
-
accessToken: string,
|
|
440
331
|
requestJson: string
|
|
441
332
|
): Promise<{ response: string }> {
|
|
442
333
|
this.validateSDKReady();
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
console.log('📧 Sending confirmation document...');
|
|
446
|
-
const result = await this.sdk.sendConfirmationDocument(accessToken, requestJson);
|
|
447
|
-
console.log('✅ Confirmation document sent successfully');
|
|
448
|
-
return result;
|
|
449
|
-
} catch (error) {
|
|
450
|
-
console.error('❌ Confirmation document sending failed:', error);
|
|
451
|
-
throw error;
|
|
452
|
-
}
|
|
334
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
335
|
+
return await this.sdk.sendConfirmationDocument(requestJson);
|
|
453
336
|
}
|
|
454
337
|
|
|
455
338
|
/**
|
|
@@ -517,13 +400,7 @@ export class FinosESignModule {
|
|
|
517
400
|
return listener;
|
|
518
401
|
}
|
|
519
402
|
|
|
520
|
-
|
|
521
|
-
const listener = this.sdk.onESignAuthenticateSuccess(callback);
|
|
522
|
-
if (!listener) {
|
|
523
|
-
console.warn('⚠️ onESignAuthenticateSuccess: Event emitter not ready.');
|
|
524
|
-
}
|
|
525
|
-
return listener;
|
|
526
|
-
}
|
|
403
|
+
|
|
527
404
|
|
|
528
405
|
public onESignRegisterRemoteSigningSuccess(callback: (data: { response: string }) => void) {
|
|
529
406
|
const listener = this.sdk.onESignRegisterRemoteSigningSuccess(callback);
|
|
@@ -561,23 +438,18 @@ export class FinosESignModule {
|
|
|
561
438
|
|
|
562
439
|
/**
|
|
563
440
|
* Start liveness detection
|
|
564
|
-
* @param config Liveness configuration
|
|
441
|
+
* @param config Liveness configuration
|
|
442
|
+
* @param config.isActiveLiveness - Enable active liveness detection (default: false)
|
|
443
|
+
* @param config.autoCapture - Enable auto capture (default: true)
|
|
444
|
+
* @param config.isShowCameraFont - Show camera font (default: true)
|
|
445
|
+
* @param config.customActions - Custom actions array (LEFT, RIGHT, STRAIGHT). If provided, uses these actions instead of random
|
|
446
|
+
* @param config.activeActionCount - Number of random actions (1-10), only used when customActions is null (default: 2)
|
|
447
|
+
* @param config.switchFrontCamera - Use front camera (default: false)
|
|
565
448
|
*/
|
|
566
449
|
public async startLiveness(config: LivenessConfig): Promise<SDKEkycResultStringWithEvent> {
|
|
567
450
|
this.validateSDKReady();
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
console.log('👁️ Starting liveness detection...');
|
|
571
|
-
if (config.switchFrontCamera !== undefined) {
|
|
572
|
-
console.log('📷 Front camera setting:', config.switchFrontCamera ? 'ON' : 'OFF');
|
|
573
|
-
}
|
|
574
|
-
const result = await this.sdk.startLiveness(config);
|
|
575
|
-
console.log('✅ Liveness detection completed:', result.event);
|
|
576
|
-
return result;
|
|
577
|
-
} catch (error) {
|
|
578
|
-
console.error('❌ Liveness detection failed:', error);
|
|
579
|
-
throw error;
|
|
580
|
-
}
|
|
451
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
452
|
+
return await this.sdk.startLiveness(config);
|
|
581
453
|
}
|
|
582
454
|
|
|
583
455
|
// Liveness Event Listeners
|
|
@@ -597,16 +469,8 @@ export class FinosESignModule {
|
|
|
597
469
|
*/
|
|
598
470
|
public async startFaceCompare(config: FaceServiceConfig): Promise<SDKEkycResultStringWithEvent> {
|
|
599
471
|
this.validateSDKReady();
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
console.log('👤 Starting face comparison...');
|
|
603
|
-
const result = await this.sdk.startFaceCompare(config);
|
|
604
|
-
console.log('✅ Face comparison completed:', result.event);
|
|
605
|
-
return result;
|
|
606
|
-
} catch (error) {
|
|
607
|
-
console.error('❌ Face comparison failed:', error);
|
|
608
|
-
throw error;
|
|
609
|
-
}
|
|
472
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
473
|
+
return await this.sdk.startFaceCompare(config);
|
|
610
474
|
}
|
|
611
475
|
|
|
612
476
|
// Face Compare Event Listeners
|
|
@@ -686,7 +550,7 @@ export class FinosESignModule {
|
|
|
686
550
|
}
|
|
687
551
|
): Promise<any> {
|
|
688
552
|
this.validateSDKReady();
|
|
689
|
-
|
|
553
|
+
|
|
690
554
|
// Validate flowSDK - only allow LIVENESS and FACE
|
|
691
555
|
const allowedTypes = ['LIVENESS', 'FACE'];
|
|
692
556
|
const invalidTypes = flowSDK.filter(type => !allowedTypes.includes(type));
|
|
@@ -697,41 +561,27 @@ export class FinosESignModule {
|
|
|
697
561
|
if (flowSDK.length === 0) {
|
|
698
562
|
throw new Error('flowSDK must contain at least one SDK type (LIVENESS or FACE)');
|
|
699
563
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
appKey,
|
|
722
|
-
flowSDK,
|
|
723
|
-
language,
|
|
724
|
-
transactionId,
|
|
725
|
-
fullAppKeyConfig,
|
|
726
|
-
optionConfig,
|
|
727
|
-
styleConfig
|
|
728
|
-
);
|
|
729
|
-
console.log('✅ eKYC UI started successfully');
|
|
730
|
-
return result;
|
|
731
|
-
} catch (error) {
|
|
732
|
-
console.error('❌ eKYC UI failed:', error);
|
|
733
|
-
throw error;
|
|
734
|
-
}
|
|
564
|
+
|
|
565
|
+
// Create full appKeyConfig with empty values for excluded modules
|
|
566
|
+
const fullAppKeyConfig = {
|
|
567
|
+
appKey: appKeyConfig.appKey,
|
|
568
|
+
appKeyNfc: '',
|
|
569
|
+
appKeyOcr: '',
|
|
570
|
+
appKeyLiveness: appKeyConfig.appKeyLiveness,
|
|
571
|
+
appKeyC06: '',
|
|
572
|
+
appKeyFaceService: appKeyConfig.appKeyFaceService,
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
576
|
+
return await this.sdk.startEkycUI(
|
|
577
|
+
appKey,
|
|
578
|
+
flowSDK,
|
|
579
|
+
language,
|
|
580
|
+
transactionId,
|
|
581
|
+
fullAppKeyConfig,
|
|
582
|
+
optionConfig,
|
|
583
|
+
styleConfig
|
|
584
|
+
);
|
|
735
585
|
}
|
|
736
586
|
|
|
737
587
|
// Private validation methods
|
|
@@ -769,26 +619,25 @@ const isMethod = (prop: string | symbol): boolean => {
|
|
|
769
619
|
if (typeof prop !== 'string') return false;
|
|
770
620
|
// Check if it's a known method from the class
|
|
771
621
|
const prototype = FinosESignModule.prototype as any;
|
|
772
|
-
return typeof prototype[prop] === 'function' ||
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
prop === 'startEkycUI';
|
|
622
|
+
return typeof prototype[prop] === 'function' ||
|
|
623
|
+
prop.startsWith('on') ||
|
|
624
|
+
prop === 'initialize' ||
|
|
625
|
+
prop === 'initializeESign' ||
|
|
626
|
+
prop === 'sendOtp' ||
|
|
627
|
+
prop === 'verifyOtp' ||
|
|
628
|
+
prop === 'resendOtp' ||
|
|
629
|
+
prop === 'openSessionId' ||
|
|
630
|
+
prop === 'registerDevice' ||
|
|
631
|
+
prop === 'listCerts' ||
|
|
632
|
+
prop === 'verifyCert' ||
|
|
633
|
+
prop === 'listSignRequest' ||
|
|
634
|
+
prop === 'confirmSign' ||
|
|
635
|
+
prop === 'registerRemoteSigning' ||
|
|
636
|
+
prop === 'signPdf' ||
|
|
637
|
+
prop === 'sendConfirmationDocument' ||
|
|
638
|
+
prop === 'startLiveness' ||
|
|
639
|
+
prop === 'startFaceCompare' ||
|
|
640
|
+
prop === 'startEkycUI';
|
|
792
641
|
};
|
|
793
642
|
|
|
794
643
|
// Create a safe wrapper using Proxy - ensure it's always an object
|
|
@@ -834,39 +683,40 @@ const createFinosESignProxy = (): FinosESignModule => {
|
|
|
834
683
|
// Create a comprehensive stub object with all methods to prevent undefined errors
|
|
835
684
|
const createFinosESignStub = (): FinosESignModule => {
|
|
836
685
|
const stub = {} as any;
|
|
837
|
-
|
|
686
|
+
|
|
838
687
|
// Add all event listener methods (on* methods)
|
|
839
688
|
const eventListenerMethods = [
|
|
840
689
|
'onSmsOtpSendSuccess', 'onSmsOtpVerifySuccess', 'onSmsOtpResendSuccess', 'onSmsOtpError',
|
|
841
690
|
'onESignInitSuccess', 'onESignOpenSessionSuccess', 'onESignRegisterDeviceSuccess',
|
|
842
691
|
'onESignListCertsSuccess', 'onESignVerifyCertSuccess', 'onESignListSignRequestSuccess',
|
|
843
|
-
'onESignConfirmSignSuccess', '
|
|
692
|
+
'onESignConfirmSignSuccess', 'onESignRegisterRemoteSigningSuccess',
|
|
844
693
|
'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignError',
|
|
845
694
|
'onLivenessSuccess', 'onLivenessError', 'onFaceCompareSuccess', 'onFaceCompareError'
|
|
846
695
|
];
|
|
847
|
-
|
|
696
|
+
|
|
848
697
|
eventListenerMethods.forEach(method => {
|
|
849
698
|
stub[method] = (callback?: any) => {
|
|
850
699
|
console.warn(`⚠️ FinosESign.${method} called but module is not initialized`);
|
|
851
700
|
return null;
|
|
852
701
|
};
|
|
853
702
|
});
|
|
854
|
-
|
|
703
|
+
|
|
855
704
|
// Add all other methods
|
|
856
705
|
const otherMethods = [
|
|
857
|
-
'initialize', '
|
|
858
|
-
'
|
|
859
|
-
'
|
|
860
|
-
'
|
|
706
|
+
'initialize', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
|
|
707
|
+
'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'openSessionId',
|
|
708
|
+
'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
|
|
709
|
+
'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
|
|
710
|
+
'onResume', 'onPause', 'isSDKReady', 'getSDKInfo'
|
|
861
711
|
];
|
|
862
|
-
|
|
712
|
+
|
|
863
713
|
otherMethods.forEach(method => {
|
|
864
714
|
stub[method] = async (...args: any[]) => {
|
|
865
715
|
console.warn(`⚠️ FinosESign.${method} called but module is not initialized`);
|
|
866
716
|
throw new Error(`FinosESign.${method} is not available. Module may not be initialized.`);
|
|
867
717
|
};
|
|
868
718
|
});
|
|
869
|
-
|
|
719
|
+
|
|
870
720
|
return stub as FinosESignModule;
|
|
871
721
|
};
|
|
872
722
|
|
|
@@ -876,18 +726,18 @@ const createFinosESignWrapper = (): FinosESignModule => {
|
|
|
876
726
|
// Always start with stub to ensure all methods exist
|
|
877
727
|
const stub = createFinosESignStub();
|
|
878
728
|
const wrapper = { ...stub } as any;
|
|
879
|
-
|
|
729
|
+
|
|
880
730
|
// Try to get real instance and override methods
|
|
881
731
|
try {
|
|
882
732
|
const realInstance = getFinosESignInstance();
|
|
883
|
-
|
|
733
|
+
|
|
884
734
|
// Override with real instance methods
|
|
885
735
|
Object.getOwnPropertyNames(Object.getPrototypeOf(realInstance)).forEach(key => {
|
|
886
736
|
if (key !== 'constructor' && typeof (realInstance as any)[key] === 'function') {
|
|
887
737
|
wrapper[key] = ((realInstance as any)[key]).bind(realInstance);
|
|
888
738
|
}
|
|
889
739
|
});
|
|
890
|
-
|
|
740
|
+
|
|
891
741
|
// Also copy any own properties from real instance
|
|
892
742
|
Object.keys(realInstance).forEach(key => {
|
|
893
743
|
if ((realInstance as any)[key] !== undefined) {
|
|
@@ -898,7 +748,7 @@ const createFinosESignWrapper = (): FinosESignModule => {
|
|
|
898
748
|
// If we can't get instance, wrapper already has all stub methods
|
|
899
749
|
// No need to do anything
|
|
900
750
|
}
|
|
901
|
-
|
|
751
|
+
|
|
902
752
|
return wrapper as FinosESignModule;
|
|
903
753
|
};
|
|
904
754
|
|
|
@@ -909,6 +759,7 @@ export const FinosESign = createFinosESignWrapper();
|
|
|
909
759
|
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
910
760
|
export type { UserEsignModel, ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
|
|
911
761
|
export type { LivenessConfig } from '../types/ekycLivenessType';
|
|
762
|
+
export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
912
763
|
export type { FaceServiceConfig } from '../types/ekycFaceType';
|
|
913
764
|
export type { SDKEkycResultStringWithEvent, SDKEkycResultWithEvent } from '../types/ekycType';
|
|
914
765
|
|
package/src/modules/README.md
CHANGED
|
@@ -100,14 +100,20 @@ try {
|
|
|
100
100
|
### Liveness Detection
|
|
101
101
|
|
|
102
102
|
```typescript
|
|
103
|
-
import { finosEKYC, LivenessConfig } from '@finos_sdk/sdk-ekyc';
|
|
103
|
+
import { finosEKYC, LivenessConfig, SDKFaceDetectStatus } from '@finos_sdk/sdk-ekyc';
|
|
104
104
|
|
|
105
105
|
const livenessConfig: LivenessConfig = {
|
|
106
106
|
appKey: 'your-app-key',
|
|
107
107
|
selfieImage: 'base64-selfie-data',
|
|
108
108
|
usingRandomAction: true,
|
|
109
109
|
transactionId: 'txn-123',
|
|
110
|
-
isStraight: true
|
|
110
|
+
isStraight: true,
|
|
111
|
+
// New parameters for version 1.3.0
|
|
112
|
+
isActiveLiveness: true,
|
|
113
|
+
autoCapture: true,
|
|
114
|
+
isShowCameraFont: true,
|
|
115
|
+
customActions: [SDKFaceDetectStatus.LEFT, SDKFaceDetectStatus.RIGHT],
|
|
116
|
+
activeActionCount: 2
|
|
111
117
|
};
|
|
112
118
|
|
|
113
119
|
try {
|
|
@@ -269,6 +275,19 @@ interface LivenessConfig {
|
|
|
269
275
|
usingRandomAction: boolean;
|
|
270
276
|
transactionId: string;
|
|
271
277
|
isStraight: boolean;
|
|
278
|
+
switchFrontCamera?: boolean;
|
|
279
|
+
// New parameters for version 1.3.0
|
|
280
|
+
isActiveLiveness?: boolean; // Enable active liveness detection (default: false)
|
|
281
|
+
autoCapture?: boolean; // Enable auto capture (default: true)
|
|
282
|
+
isShowCameraFont?: boolean; // Show camera font (default: true)
|
|
283
|
+
customActions?: SDKFaceDetectStatus[]; // Custom actions array (LEFT, RIGHT, STRAIGHT)
|
|
284
|
+
activeActionCount?: number; // Number of random actions (1-10), only used when customActions = null (default: 2)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
enum SDKFaceDetectStatus {
|
|
288
|
+
LEFT = "LEFT",
|
|
289
|
+
RIGHT = "RIGHT",
|
|
290
|
+
STRAIGHT = "STRAIGHT"
|
|
272
291
|
}
|
|
273
292
|
```
|
|
274
293
|
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { CheckSummaryResponse } from "./ekycOCRType";
|
|
2
2
|
|
|
3
|
+
export enum SDKFaceDetectStatus {
|
|
4
|
+
LEFT = "LEFT",
|
|
5
|
+
RIGHT = "RIGHT",
|
|
6
|
+
STRAIGHT = "STRAIGHT"
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
export interface LivenessConfig {
|
|
4
10
|
appKey: string;
|
|
5
11
|
transactionId?: string;
|
|
6
|
-
usingRandomAction
|
|
7
|
-
|
|
12
|
+
// old fields usingRandomAction and isStraight removed in 1.3.1
|
|
13
|
+
// usingRandomAction: boolean;
|
|
14
|
+
// isStraight: boolean;
|
|
8
15
|
selfieImage: string;
|
|
9
16
|
switchFrontCamera?: boolean;
|
|
17
|
+
// New fields for version 1.3.0
|
|
18
|
+
isActiveLiveness?: boolean;
|
|
19
|
+
autoCapture?: boolean;
|
|
20
|
+
isShowCameraFont?: boolean;
|
|
21
|
+
customActions?: SDKFaceDetectStatus[];
|
|
22
|
+
activeActionCount?: number;
|
|
23
|
+
forceCaptureTimeout?: number;
|
|
10
24
|
}
|
|
11
25
|
|
|
12
26
|
export interface CheckLivenessResponse {
|
|
Binary file
|