@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.
- package/android/build.gradle +1 -1
- package/android/src/main/java/finos/sdk/ekyc/EKYCModule.kt +185 -106
- package/dist/EKYCModule.d.ts +19 -4
- package/dist/EKYCModule.js +39 -5
- package/dist/index.d.ts +4 -3
- package/dist/index.js +8 -1
- package/dist/package.json +1 -1
- package/dist/src/modules/FinosEKYCModule.d.ts +21 -13
- package/dist/src/modules/FinosEKYCModule.js +14 -20
- package/dist/src/modules/FinosESignModule.d.ts +21 -9
- package/dist/src/modules/FinosESignModule.js +31 -12
- package/dist/src/types/ekycESignType.d.ts +3 -18
- package/dist/src/types/ekycFlowType.d.ts +17 -0
- package/dist/src/types/ekycFlowType.js +28 -0
- package/dist/src/types/ekycLivenessType.d.ts +16 -0
- package/dist/src/types/ekycLivenessType.js +32 -1
- package/dist/src/types/ekycType.d.ts +30 -0
- package/package.json +1 -1
- package/src/modules/FinosEKYCModule.ts +34 -35
- package/src/modules/FinosESignModule.ts +44 -21
- package/src/types/ekycESignType.ts +5 -21
- package/src/types/ekycFlowType.ts +25 -0
- package/src/types/ekycLivenessType.ts +33 -1
- package/src/types/ekycType.ts +31 -0
|
@@ -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';
|
|
@@ -197,32 +197,30 @@ export class FinosESignModule {
|
|
|
197
197
|
return await this.sdk.getSdkToken(identity, name, deviceId);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
|
|
200
201
|
/**
|
|
201
|
-
* Open eSign
|
|
202
|
-
* @param accessToken
|
|
203
|
-
* @param username
|
|
204
|
-
* @param rememberMe Remember
|
|
205
|
-
* @param userEsignModel User info for auto
|
|
206
|
-
* @param privateKeyFilePath Path to private key file
|
|
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)
|
|
207
208
|
*/
|
|
208
209
|
public async openSessionId(
|
|
209
|
-
accessToken
|
|
210
|
-
username
|
|
211
|
-
rememberMe
|
|
212
|
-
userEsignModel?: UserEsignModel,
|
|
213
|
-
privateKeyFilePath?: string
|
|
210
|
+
accessToken: string | null,
|
|
211
|
+
username: string | null,
|
|
212
|
+
rememberMe: boolean | null
|
|
214
213
|
): Promise<ESignOpenSessionResult> {
|
|
215
214
|
this.validateSDKReady();
|
|
216
215
|
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
217
216
|
return await this.sdk.openSessionId(
|
|
218
217
|
accessToken,
|
|
219
218
|
username,
|
|
220
|
-
rememberMe
|
|
221
|
-
userEsignModel,
|
|
222
|
-
privateKeyFilePath
|
|
219
|
+
rememberMe
|
|
223
220
|
);
|
|
224
221
|
}
|
|
225
222
|
|
|
223
|
+
|
|
226
224
|
/**
|
|
227
225
|
* Register device for eSign
|
|
228
226
|
* @param recoverCode 8-digit recovery code
|
|
@@ -335,6 +333,20 @@ export class FinosESignModule {
|
|
|
335
333
|
return await this.sdk.sendConfirmationDocument(requestJson);
|
|
336
334
|
}
|
|
337
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Composite API: Register Remote Signing + Send Confirmation Document
|
|
338
|
+
* Align với SdkeSignImpl.registerAndConfirm
|
|
339
|
+
* @param requestJson JSON request body for registerRemoteSigning
|
|
340
|
+
* @param confirmationDocBase64 PDF base64 for acceptanceDocs
|
|
341
|
+
*/
|
|
342
|
+
public async registerAndConfirm(
|
|
343
|
+
requestJson: string,
|
|
344
|
+
confirmationDocBase64: string
|
|
345
|
+
): Promise<{ response: string }> {
|
|
346
|
+
this.validateSDKReady();
|
|
347
|
+
return await this.sdk.registerAndConfirm(requestJson, confirmationDocBase64);
|
|
348
|
+
}
|
|
349
|
+
|
|
338
350
|
/**
|
|
339
351
|
* Remove all event listeners
|
|
340
352
|
*/
|
|
@@ -426,6 +438,14 @@ export class FinosESignModule {
|
|
|
426
438
|
return listener;
|
|
427
439
|
}
|
|
428
440
|
|
|
441
|
+
public onESignRegisterAndConfirmSuccess(callback: (data: { response: string }) => void) {
|
|
442
|
+
const listener = this.sdk.onESignRegisterAndConfirmSuccess(callback);
|
|
443
|
+
if (!listener) {
|
|
444
|
+
console.warn('⚠️ onESignRegisterAndConfirmSuccess: Event emitter not ready.');
|
|
445
|
+
}
|
|
446
|
+
return listener;
|
|
447
|
+
}
|
|
448
|
+
|
|
429
449
|
public onESignError(callback: (error: ESignError) => void) {
|
|
430
450
|
const listener = this.sdk.onESignError(callback);
|
|
431
451
|
if (!listener) {
|
|
@@ -623,16 +643,19 @@ const isMethod = (prop: string | symbol): boolean => {
|
|
|
623
643
|
prop.startsWith('on') ||
|
|
624
644
|
prop === 'initialize' ||
|
|
625
645
|
prop === 'initializeESign' ||
|
|
646
|
+
prop === 'getSdkToken' ||
|
|
647
|
+
prop === 'openSessionId' ||
|
|
626
648
|
prop === 'sendOtp' ||
|
|
627
649
|
prop === 'verifyOtp' ||
|
|
628
650
|
prop === 'resendOtp' ||
|
|
629
|
-
|
|
651
|
+
|
|
630
652
|
prop === 'registerDevice' ||
|
|
631
653
|
prop === 'listCerts' ||
|
|
632
654
|
prop === 'verifyCert' ||
|
|
633
655
|
prop === 'listSignRequest' ||
|
|
634
656
|
prop === 'confirmSign' ||
|
|
635
657
|
prop === 'registerRemoteSigning' ||
|
|
658
|
+
prop === 'registerAndConfirm' ||
|
|
636
659
|
prop === 'signPdf' ||
|
|
637
660
|
prop === 'sendConfirmationDocument' ||
|
|
638
661
|
prop === 'startLiveness' ||
|
|
@@ -689,8 +712,8 @@ const createFinosESignStub = (): FinosESignModule => {
|
|
|
689
712
|
'onSmsOtpSendSuccess', 'onSmsOtpVerifySuccess', 'onSmsOtpResendSuccess', 'onSmsOtpError',
|
|
690
713
|
'onESignInitSuccess', 'onESignOpenSessionSuccess', 'onESignRegisterDeviceSuccess',
|
|
691
714
|
'onESignListCertsSuccess', 'onESignVerifyCertSuccess', 'onESignListSignRequestSuccess',
|
|
692
|
-
'onESignConfirmSignSuccess',
|
|
693
|
-
'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignError',
|
|
715
|
+
'onESignConfirmSignSuccess', 'onESignRegisterRemoteSigningSuccess',
|
|
716
|
+
'onESignSignPdfSuccess', 'onESignSendConfirmationDocumentSuccess', 'onESignRegisterAndConfirmSuccess', 'onESignError',
|
|
694
717
|
'onLivenessSuccess', 'onLivenessError', 'onFaceCompareSuccess', 'onFaceCompareError'
|
|
695
718
|
];
|
|
696
719
|
|
|
@@ -704,9 +727,9 @@ const createFinosESignStub = (): FinosESignModule => {
|
|
|
704
727
|
// Add all other methods
|
|
705
728
|
const otherMethods = [
|
|
706
729
|
'initialize', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
|
|
707
|
-
'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'openSessionId',
|
|
730
|
+
'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'getSdkToken', 'openSessionId',
|
|
708
731
|
'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
|
|
709
|
-
'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
|
|
732
|
+
'registerRemoteSigning', 'registerAndConfirm', 'signPdf', 'sendConfirmationDocument',
|
|
710
733
|
'onResume', 'onPause', 'isSDKReady', 'getSDKInfo'
|
|
711
734
|
];
|
|
712
735
|
|
|
@@ -757,7 +780,7 @@ export const FinosESign = createFinosESignWrapper();
|
|
|
757
780
|
|
|
758
781
|
// Export types
|
|
759
782
|
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
760
|
-
export type {
|
|
783
|
+
export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
|
|
761
784
|
export type { LivenessConfig } from '../types/ekycLivenessType';
|
|
762
785
|
export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
763
786
|
export type { FaceServiceConfig } from '../types/ekycFaceType';
|
|
@@ -1,31 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
4
|
+
* eSign Initialize Result
|
|
3
5
|
*/
|
|
4
6
|
export interface UserEsignModel {
|
|
5
|
-
/**
|
|
6
|
-
* ID card number (CCCD/CMND)
|
|
7
|
-
*/
|
|
8
7
|
cccd: string;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* User name
|
|
12
|
-
*/
|
|
13
8
|
name: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Device type (e.g., "Android", "iOS")
|
|
17
|
-
*/
|
|
18
|
-
device: string;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Device ID
|
|
22
|
-
*/
|
|
23
|
-
deviceId: string;
|
|
9
|
+
device?: string;
|
|
10
|
+
deviceId?: string;
|
|
24
11
|
}
|
|
25
12
|
|
|
26
|
-
/**
|
|
27
|
-
* eSign Initialize Result
|
|
28
|
-
*/
|
|
29
13
|
export interface ESignInitResult {
|
|
30
14
|
code: string;
|
|
31
15
|
message: string;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 enum SDKFlowType {
|
|
10
|
+
OCR = 'OCR',
|
|
11
|
+
NFC = 'NFC',
|
|
12
|
+
LIVENESS = 'LIVENESS',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Mảng đầy đủ các bước (dùng cho picker / default flow). */
|
|
16
|
+
export const SDK_FLOW_OPTIONS: readonly SDKFlowType[] = [
|
|
17
|
+
SDKFlowType.OCR,
|
|
18
|
+
SDKFlowType.NFC,
|
|
19
|
+
SDKFlowType.LIVENESS,
|
|
20
|
+
] as const;
|
|
21
|
+
|
|
22
|
+
/** Chuyển flow enum[] sang string[] khi gửi xuống native (giá trị enum đã là 'OCR'|'NFC'|'LIVENESS'). */
|
|
23
|
+
export function flowToStrings(flow: SDKFlowType[]): string[] {
|
|
24
|
+
return flow.map(f => f as string);
|
|
25
|
+
}
|
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
import { CheckSummaryResponse } from "./ekycOCRType";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Custom actions cho liveness – map Android SDKFaceDetectStatus.
|
|
5
|
+
* Bên sử dụng truyền enum vào optionConfig.customActions thay vì string.
|
|
6
|
+
*/
|
|
3
7
|
export enum SDKFaceDetectStatus {
|
|
4
8
|
LEFT = "LEFT",
|
|
5
9
|
RIGHT = "RIGHT",
|
|
6
|
-
|
|
10
|
+
UP = "UP",
|
|
11
|
+
DOWN = "DOWN",
|
|
12
|
+
SMILE = "SMILE",
|
|
13
|
+
BLINK = "BLINK",
|
|
14
|
+
TILT_LEFT = "TILT_LEFT",
|
|
15
|
+
TILT_RIGHT = "TILT_RIGHT",
|
|
16
|
+
WINK_LEFT = "WINK_LEFT",
|
|
17
|
+
WINK_RIGHT = "WINK_RIGHT",
|
|
18
|
+
STRAIGHT = "STRAIGHT",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Mảng đầy đủ các action (trừ STRAIGHT thường được SDK tự thêm cuối) – dùng cho picker / default. */
|
|
22
|
+
export const SDK_LIVENESS_ACTIONS: readonly SDKFaceDetectStatus[] = [
|
|
23
|
+
SDKFaceDetectStatus.LEFT,
|
|
24
|
+
SDKFaceDetectStatus.RIGHT,
|
|
25
|
+
SDKFaceDetectStatus.UP,
|
|
26
|
+
SDKFaceDetectStatus.DOWN,
|
|
27
|
+
SDKFaceDetectStatus.SMILE,
|
|
28
|
+
SDKFaceDetectStatus.BLINK,
|
|
29
|
+
SDKFaceDetectStatus.TILT_LEFT,
|
|
30
|
+
SDKFaceDetectStatus.TILT_RIGHT,
|
|
31
|
+
SDKFaceDetectStatus.WINK_LEFT,
|
|
32
|
+
SDKFaceDetectStatus.WINK_RIGHT,
|
|
33
|
+
SDKFaceDetectStatus.STRAIGHT,
|
|
34
|
+
] as const;
|
|
35
|
+
|
|
36
|
+
/** Chuyển customActions enum[] sang string[] khi gửi xuống native. */
|
|
37
|
+
export function customActionsToStrings(actions: SDKFaceDetectStatus[]): string[] {
|
|
38
|
+
return actions.map(a => a as string);
|
|
7
39
|
}
|
|
8
40
|
|
|
9
41
|
export interface LivenessConfig {
|
package/src/types/ekycType.ts
CHANGED
|
@@ -22,4 +22,35 @@ export interface SDKEkycResultWithEvent {
|
|
|
22
22
|
export interface SDKEkycResultStringWithEvent {
|
|
23
23
|
data: string;
|
|
24
24
|
event: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Result from startEkycUI() – maps Android SDK data.ekycStateModel.eKYCFileModel.
|
|
29
|
+
* Use the same shape as Android: data?.ekycStateModel?.eKYCFileModel?.imageFace.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const result = await sdkEKYC.startEkycUI(...);
|
|
33
|
+
* const selfieBase64 = result?.imageFace; // base64 selfie (liveness/face)
|
|
34
|
+
* const frontBase64 = result?.imageOcrFront; // base64 CCCD/CMND mặt trước
|
|
35
|
+
* const backBase64 = result?.imageOcrBack; // base64 CCCD/CMND mặt sau
|
|
36
|
+
* const selfiePath = result?.imageFacePath; // file path (e.g. for FormData)
|
|
37
|
+
* const transactionId = result?.transactionId;
|
|
38
|
+
*/
|
|
39
|
+
export interface StartEkycUIResult {
|
|
40
|
+
status: 'success';
|
|
41
|
+
event: string;
|
|
42
|
+
data?: string;
|
|
43
|
+
transactionId?: string;
|
|
44
|
+
/** Base64 selfie (liveness) – same as Android data.ekycStateModel.eKYCFileModel.imageFace */
|
|
45
|
+
imageFace?: string;
|
|
46
|
+
/** Base64 OCR front – same as Android eKYCFileModel.imageOcrFront */
|
|
47
|
+
imageOcrFront?: string;
|
|
48
|
+
/** Base64 OCR back – same as Android eKYCFileModel.imageOcrBack */
|
|
49
|
+
imageOcrBack?: string;
|
|
50
|
+
/** Absolute path to selfie file (e.g. for react-native-fs / FormData) */
|
|
51
|
+
imageFacePath?: string;
|
|
52
|
+
/** Absolute path to OCR front image file */
|
|
53
|
+
imageOcrFrontPath?: string;
|
|
54
|
+
/** Absolute path to OCR back image file */
|
|
55
|
+
imageOcrBackPath?: string;
|
|
25
56
|
}
|