@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.
- package/android/build.gradle +1 -1
- package/android/src/main/java/finos/sdk/ekyc/EKYCModule.kt +206 -160
- package/dist/EKYCModule.d.ts +9 -9
- package/dist/EKYCModule.js +78 -43
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/package.json +1 -1
- package/dist/src/modules/FinosEKYCModule.d.ts +23 -24
- package/dist/src/modules/FinosEKYCModule.js +42 -60
- package/dist/src/modules/FinosESignModule.d.ts +29 -24
- package/dist/src/modules/FinosESignModule.js +82 -226
- package/dist/src/types/ekycESignType.d.ts +3 -18
- 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 +92 -116
- package/src/modules/FinosESignModule.ts +130 -279
- package/src/modules/README.md +21 -2
- package/src/types/ekycESignType.ts +5 -21
- package/src/types/ekycLivenessType.ts +16 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import sdkEKYC, { SDKeKYC, SDK_VERSION, SDK_NAME } from '../../EKYCModule';
|
|
3
3
|
import { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
4
|
-
import {
|
|
4
|
+
import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
|
|
5
5
|
import { LivenessConfig } from '../types/ekycLivenessType';
|
|
6
6
|
import { FaceServiceConfig } from '../types/ekycFaceType';
|
|
7
7
|
import { SDKEkycResultStringWithEvent, SDKEkycResultWithEvent } from '../types/ekycType';
|
|
@@ -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,55 +177,50 @@ 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
|
-
console.log('🔐 Initializing eSign SDK...');
|
|
210
|
-
const result = await this.sdk.initializeESign();
|
|
211
|
-
console.log('✅ eSign SDK initialized successfully');
|
|
212
|
-
return result;
|
|
213
|
-
} catch (error) {
|
|
214
|
-
console.error('❌ eSign initialization failed:', error);
|
|
215
|
-
throw error;
|
|
216
|
-
}
|
|
184
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
185
|
+
return await this.sdk.initializeESign(finosToken);
|
|
217
186
|
}
|
|
218
187
|
|
|
219
188
|
/**
|
|
220
|
-
*
|
|
221
|
-
* @param
|
|
222
|
-
* @param
|
|
223
|
-
* @param
|
|
224
|
-
|
|
225
|
-
|
|
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);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Open eSign Session
|
|
203
|
+
* @param accessToken Access token (JWT)
|
|
204
|
+
* @param username Username
|
|
205
|
+
* @param rememberMe Remember me flag
|
|
206
|
+
* @param userEsignModel User info model (for auto-token generation)
|
|
207
|
+
* @param privateKeyFilePath Path to private key file (for auto-token generation)
|
|
226
208
|
*/
|
|
227
209
|
public async openSessionId(
|
|
228
|
-
accessToken
|
|
229
|
-
username
|
|
230
|
-
rememberMe
|
|
231
|
-
userEsignModel?: UserEsignModel,
|
|
232
|
-
privateKeyFilePath?: string
|
|
210
|
+
accessToken: string | null,
|
|
211
|
+
username: string | null,
|
|
212
|
+
rememberMe: boolean | null
|
|
233
213
|
): Promise<ESignOpenSessionResult> {
|
|
234
214
|
this.validateSDKReady();
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
rememberMe,
|
|
242
|
-
userEsignModel,
|
|
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
|
-
}
|
|
215
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
216
|
+
return await this.sdk.openSessionId(
|
|
217
|
+
accessToken,
|
|
218
|
+
username,
|
|
219
|
+
rememberMe
|
|
220
|
+
);
|
|
251
221
|
}
|
|
252
222
|
|
|
223
|
+
|
|
253
224
|
/**
|
|
254
225
|
* Register device for eSign
|
|
255
226
|
* @param recoverCode 8-digit recovery code
|
|
@@ -262,16 +233,8 @@ export class FinosESignModule {
|
|
|
262
233
|
fcmToken?: string
|
|
263
234
|
): Promise<{ code: string; message: string }> {
|
|
264
235
|
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
|
-
}
|
|
236
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
237
|
+
return await this.sdk.registerDevice(recoverCode, pinCode, fcmToken);
|
|
275
238
|
}
|
|
276
239
|
|
|
277
240
|
/**
|
|
@@ -284,16 +247,8 @@ export class FinosESignModule {
|
|
|
284
247
|
pageSize: number = 10
|
|
285
248
|
): Promise<{ certs: ESignCertificate[] }> {
|
|
286
249
|
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
|
-
}
|
|
250
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
251
|
+
return await this.sdk.listCerts(pageNumber, pageSize);
|
|
297
252
|
}
|
|
298
253
|
|
|
299
254
|
/**
|
|
@@ -302,16 +257,8 @@ export class FinosESignModule {
|
|
|
302
257
|
*/
|
|
303
258
|
public async verifyCert(serial: string): Promise<{ code: string; message: string }> {
|
|
304
259
|
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
|
-
}
|
|
260
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
261
|
+
return await this.sdk.verifyCert(serial);
|
|
315
262
|
}
|
|
316
263
|
|
|
317
264
|
/**
|
|
@@ -324,16 +271,8 @@ export class FinosESignModule {
|
|
|
324
271
|
pageSize: number = 10
|
|
325
272
|
): Promise<{ requests: ESignSignRequest[] }> {
|
|
326
273
|
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
|
-
}
|
|
274
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
275
|
+
return await this.sdk.listSignRequest(pageNumber, pageSize);
|
|
337
276
|
}
|
|
338
277
|
|
|
339
278
|
/**
|
|
@@ -352,104 +291,46 @@ export class FinosESignModule {
|
|
|
352
291
|
confirm: boolean = true
|
|
353
292
|
): Promise<{ code: string; message: string }> {
|
|
354
293
|
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
|
-
}
|
|
294
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
295
|
+
return await this.sdk.confirmSign(signRequestId, pinCode, authId, authData, confirm);
|
|
365
296
|
}
|
|
366
297
|
|
|
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
|
-
}
|
|
298
|
+
|
|
388
299
|
|
|
389
300
|
/**
|
|
390
301
|
* Register remote signing certificate
|
|
391
|
-
* @param accessToken JWT access token
|
|
392
302
|
* @param requestJson JSON request body
|
|
393
303
|
*/
|
|
394
304
|
public async registerRemoteSigning(
|
|
395
|
-
accessToken: string,
|
|
396
305
|
requestJson: string
|
|
397
306
|
): Promise<{ response: string }> {
|
|
398
307
|
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
|
-
}
|
|
308
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
309
|
+
return await this.sdk.registerRemoteSigning(requestJson);
|
|
409
310
|
}
|
|
410
311
|
|
|
411
312
|
/**
|
|
412
313
|
* Sign PDF document
|
|
413
|
-
* @param accessToken JWT access token
|
|
414
314
|
* @param requestJson JSON request body
|
|
415
315
|
*/
|
|
416
316
|
public async signPdf(
|
|
417
|
-
accessToken: string,
|
|
418
317
|
requestJson: string
|
|
419
318
|
): Promise<{ response: string }> {
|
|
420
319
|
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
|
-
}
|
|
320
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
321
|
+
return await this.sdk.signPdf(requestJson);
|
|
431
322
|
}
|
|
432
323
|
|
|
433
324
|
/**
|
|
434
325
|
* Send confirmation document
|
|
435
|
-
* @param accessToken JWT access token
|
|
436
326
|
* @param requestJson JSON string containing request data
|
|
437
327
|
*/
|
|
438
328
|
public async sendConfirmationDocument(
|
|
439
|
-
accessToken: string,
|
|
440
329
|
requestJson: string
|
|
441
330
|
): Promise<{ response: string }> {
|
|
442
331
|
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
|
-
}
|
|
332
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
333
|
+
return await this.sdk.sendConfirmationDocument(requestJson);
|
|
453
334
|
}
|
|
454
335
|
|
|
455
336
|
/**
|
|
@@ -517,13 +398,7 @@ export class FinosESignModule {
|
|
|
517
398
|
return listener;
|
|
518
399
|
}
|
|
519
400
|
|
|
520
|
-
|
|
521
|
-
const listener = this.sdk.onESignAuthenticateSuccess(callback);
|
|
522
|
-
if (!listener) {
|
|
523
|
-
console.warn('⚠️ onESignAuthenticateSuccess: Event emitter not ready.');
|
|
524
|
-
}
|
|
525
|
-
return listener;
|
|
526
|
-
}
|
|
401
|
+
|
|
527
402
|
|
|
528
403
|
public onESignRegisterRemoteSigningSuccess(callback: (data: { response: string }) => void) {
|
|
529
404
|
const listener = this.sdk.onESignRegisterRemoteSigningSuccess(callback);
|
|
@@ -561,23 +436,18 @@ export class FinosESignModule {
|
|
|
561
436
|
|
|
562
437
|
/**
|
|
563
438
|
* Start liveness detection
|
|
564
|
-
* @param config Liveness configuration
|
|
439
|
+
* @param config Liveness configuration
|
|
440
|
+
* @param config.isActiveLiveness - Enable active liveness detection (default: false)
|
|
441
|
+
* @param config.autoCapture - Enable auto capture (default: true)
|
|
442
|
+
* @param config.isShowCameraFont - Show camera font (default: true)
|
|
443
|
+
* @param config.customActions - Custom actions array (LEFT, RIGHT, STRAIGHT). If provided, uses these actions instead of random
|
|
444
|
+
* @param config.activeActionCount - Number of random actions (1-10), only used when customActions is null (default: 2)
|
|
445
|
+
* @param config.switchFrontCamera - Use front camera (default: false)
|
|
565
446
|
*/
|
|
566
447
|
public async startLiveness(config: LivenessConfig): Promise<SDKEkycResultStringWithEvent> {
|
|
567
448
|
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
|
-
}
|
|
449
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
450
|
+
return await this.sdk.startLiveness(config);
|
|
581
451
|
}
|
|
582
452
|
|
|
583
453
|
// Liveness Event Listeners
|
|
@@ -597,16 +467,8 @@ export class FinosESignModule {
|
|
|
597
467
|
*/
|
|
598
468
|
public async startFaceCompare(config: FaceServiceConfig): Promise<SDKEkycResultStringWithEvent> {
|
|
599
469
|
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
|
-
}
|
|
470
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
471
|
+
return await this.sdk.startFaceCompare(config);
|
|
610
472
|
}
|
|
611
473
|
|
|
612
474
|
// Face Compare Event Listeners
|
|
@@ -686,7 +548,7 @@ export class FinosESignModule {
|
|
|
686
548
|
}
|
|
687
549
|
): Promise<any> {
|
|
688
550
|
this.validateSDKReady();
|
|
689
|
-
|
|
551
|
+
|
|
690
552
|
// Validate flowSDK - only allow LIVENESS and FACE
|
|
691
553
|
const allowedTypes = ['LIVENESS', 'FACE'];
|
|
692
554
|
const invalidTypes = flowSDK.filter(type => !allowedTypes.includes(type));
|
|
@@ -697,41 +559,27 @@ export class FinosESignModule {
|
|
|
697
559
|
if (flowSDK.length === 0) {
|
|
698
560
|
throw new Error('flowSDK must contain at least one SDK type (LIVENESS or FACE)');
|
|
699
561
|
}
|
|
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
|
-
}
|
|
562
|
+
|
|
563
|
+
// Create full appKeyConfig with empty values for excluded modules
|
|
564
|
+
const fullAppKeyConfig = {
|
|
565
|
+
appKey: appKeyConfig.appKey,
|
|
566
|
+
appKeyNfc: '',
|
|
567
|
+
appKeyOcr: '',
|
|
568
|
+
appKeyLiveness: appKeyConfig.appKeyLiveness,
|
|
569
|
+
appKeyC06: '',
|
|
570
|
+
appKeyFaceService: appKeyConfig.appKeyFaceService,
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
574
|
+
return await this.sdk.startEkycUI(
|
|
575
|
+
appKey,
|
|
576
|
+
flowSDK,
|
|
577
|
+
language,
|
|
578
|
+
transactionId,
|
|
579
|
+
fullAppKeyConfig,
|
|
580
|
+
optionConfig,
|
|
581
|
+
styleConfig
|
|
582
|
+
);
|
|
735
583
|
}
|
|
736
584
|
|
|
737
585
|
// Private validation methods
|
|
@@ -769,26 +617,27 @@ const isMethod = (prop: string | symbol): boolean => {
|
|
|
769
617
|
if (typeof prop !== 'string') return false;
|
|
770
618
|
// Check if it's a known method from the class
|
|
771
619
|
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
|
-
|
|
620
|
+
return typeof prototype[prop] === 'function' ||
|
|
621
|
+
prop.startsWith('on') ||
|
|
622
|
+
prop === 'initialize' ||
|
|
623
|
+
prop === 'initializeESign' ||
|
|
624
|
+
prop === 'getSdkToken' ||
|
|
625
|
+
prop === 'openSessionId' ||
|
|
626
|
+
prop === 'sendOtp' ||
|
|
627
|
+
prop === 'verifyOtp' ||
|
|
628
|
+
prop === 'resendOtp' ||
|
|
629
|
+
|
|
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', 'getSdkToken', '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
|
|
|
@@ -907,8 +757,9 @@ export const FinosESign = createFinosESignWrapper();
|
|
|
907
757
|
|
|
908
758
|
// Export types
|
|
909
759
|
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
910
|
-
export type {
|
|
760
|
+
export type { 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
|
|