@finos_sdk/sdk-ekyc 1.5.3 → 1.5.4
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 +33 -3
- package/dist/EKYCModule.d.ts +3 -1
- package/dist/EKYCModule.js +30 -26
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/dist/package.json +1 -1
- package/dist/src/modules/FinosEKYCModule.d.ts +13 -3
- package/dist/src/modules/FinosEKYCModule.js +31 -5
- package/dist/src/modules/FinosESignModule.d.ts +1 -1
- package/dist/src/modules/FinosESignModule.js +2 -2
- package/dist/src/types/ekycType.d.ts +8 -0
- package/dist/src/types/ekycType.js +10 -1
- package/package.json +1 -1
- package/src/modules/FinosEKYCModule.ts +32 -6
- package/src/modules/FinosESignModule.ts +2 -2
- package/src/types/ekycType.ts +9 -0
- package/dist/dist/package.json +0 -86
package/android/build.gradle
CHANGED
|
@@ -65,7 +65,7 @@ dependencies {
|
|
|
65
65
|
implementation 'com.facebook.react:react-android'
|
|
66
66
|
|
|
67
67
|
// Finos eKYC SDK dependencies from GitHub Packages Maven repository
|
|
68
|
-
def sdkVersion = "1.5.
|
|
68
|
+
def sdkVersion = "1.5.4"
|
|
69
69
|
implementation("finos.sdk.ekyc:ekyc:$sdkVersion")
|
|
70
70
|
implementation("finos.sdk.ekyc:ekycui:$sdkVersion")
|
|
71
71
|
implementation("finos.sdk.ekyc:nfc:$sdkVersion")
|
|
@@ -733,10 +733,10 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
733
733
|
}
|
|
734
734
|
|
|
735
735
|
@ReactMethod
|
|
736
|
-
fun initSdkEkyc(promise: Promise) {
|
|
737
|
-
Log.d(TAG, "▶️ initSdkEkyc() called")
|
|
736
|
+
fun initSdkEkyc(isProd: Boolean, promise: Promise) {
|
|
737
|
+
Log.d(TAG, "▶️ initSdkEkyc() called, isProd: $isProd")
|
|
738
738
|
try {
|
|
739
|
-
eKYCFinOS.initSDKEkyc(reactApplicationContext) {
|
|
739
|
+
eKYCFinOS.initSDKEkyc(reactApplicationContext, isProd) {
|
|
740
740
|
Log.d(TAG, "✅ initSdkEkyc() success")
|
|
741
741
|
val params =
|
|
742
742
|
Arguments.createMap().apply {
|
|
@@ -777,6 +777,36 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
779
|
|
|
780
|
+
@ReactMethod
|
|
781
|
+
fun setEnv(env: String, promise: Promise) {
|
|
782
|
+
Log.d(TAG, "▶️ setEnv() called with: $env")
|
|
783
|
+
try {
|
|
784
|
+
val sdkEnv = when (env.uppercase()) {
|
|
785
|
+
"PROD" -> finos.sdk.core.constant.SDKEnv.PROD
|
|
786
|
+
else -> finos.sdk.core.constant.SDKEnv.DEV
|
|
787
|
+
}
|
|
788
|
+
eKYCFinOS.setEnv(sdkEnv)
|
|
789
|
+
Log.d(TAG, "✅ setEnv() success: $sdkEnv")
|
|
790
|
+
promise.resolve(sdkEnv.name)
|
|
791
|
+
} catch (e: Exception) {
|
|
792
|
+
Log.e(TAG, "❌ setEnv() failed: ${e.message}", e)
|
|
793
|
+
promise.reject("SET_ENV_ERROR", "Failed to set environment: ${e.message}")
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
@ReactMethod
|
|
798
|
+
fun getEnv(promise: Promise) {
|
|
799
|
+
Log.d(TAG, "▶️ getEnv() called")
|
|
800
|
+
try {
|
|
801
|
+
val env = eKYCFinOS.getEnv()
|
|
802
|
+
Log.d(TAG, "✅ getEnv() success: $env")
|
|
803
|
+
promise.resolve(env.name)
|
|
804
|
+
} catch (e: Exception) {
|
|
805
|
+
Log.e(TAG, "❌ getEnv() failed: ${e.message}", e)
|
|
806
|
+
promise.reject("GET_ENV_ERROR", "Failed to get environment: ${e.message}")
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
780
810
|
@ReactMethod
|
|
781
811
|
fun startNfcScan(
|
|
782
812
|
appKey: String,
|
package/dist/EKYCModule.d.ts
CHANGED
|
@@ -22,8 +22,10 @@ declare class SDKeKYC {
|
|
|
22
22
|
version: string;
|
|
23
23
|
buildNumber: string;
|
|
24
24
|
}>;
|
|
25
|
-
initSdkEkyc(): Promise<string>;
|
|
25
|
+
initSdkEkyc(isProd?: boolean): Promise<string>;
|
|
26
26
|
setTransactionId(transactionId: string): Promise<boolean>;
|
|
27
|
+
setEnv(env: string): Promise<string>;
|
|
28
|
+
getEnv(): Promise<string>;
|
|
27
29
|
isSDKInitialized(): boolean;
|
|
28
30
|
private ensureNativeModule;
|
|
29
31
|
private validateConfig;
|
package/dist/EKYCModule.js
CHANGED
|
@@ -26,29 +26,6 @@ if (!EKYCNativeModule) {
|
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
console.log('✅ Native module loaded');
|
|
29
|
-
// Initialize the module with Koin error handling
|
|
30
|
-
try {
|
|
31
|
-
EKYCNativeModule.initSdkEkyc()
|
|
32
|
-
.then(() => {
|
|
33
|
-
console.log("✅ SDK initialized");
|
|
34
|
-
})
|
|
35
|
-
.catch(e => {
|
|
36
|
-
if (e && e.toString().includes('Koin Application has already been started')) {
|
|
37
|
-
console.log("✅ SDK already initialized");
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
console.warn("❌ Failed to initialize SDK:", e);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
if (e && e.toString().includes('Koin Application has already been started')) {
|
|
46
|
-
console.log("✅ SDK already initialized");
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
console.warn("❌ Exception when initializing SDK:", e);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
29
|
}
|
|
53
30
|
class SDKeKYC {
|
|
54
31
|
constructor() {
|
|
@@ -110,14 +87,14 @@ class SDKeKYC {
|
|
|
110
87
|
}
|
|
111
88
|
}
|
|
112
89
|
// Initialize SDK with better error handling
|
|
113
|
-
async initSdkEkyc() {
|
|
90
|
+
async initSdkEkyc(isProd = false) {
|
|
114
91
|
if (!EKYCNativeModule) {
|
|
115
92
|
const error = 'EKYCModule native module is not available. Please check autolinking.';
|
|
116
93
|
console.error('❌', error);
|
|
117
94
|
throw new Error(error);
|
|
118
95
|
}
|
|
119
96
|
try {
|
|
120
|
-
const result = await EKYCNativeModule.initSdkEkyc();
|
|
97
|
+
const result = await EKYCNativeModule.initSdkEkyc(isProd);
|
|
121
98
|
this.isInitialized = true;
|
|
122
99
|
console.log('✅ SDK EKYC initialized successfully');
|
|
123
100
|
return result;
|
|
@@ -125,8 +102,13 @@ class SDKeKYC {
|
|
|
125
102
|
catch (error) {
|
|
126
103
|
// Handle Koin Application already started error
|
|
127
104
|
if (error && error.toString().includes('Koin Application has already been started')) {
|
|
128
|
-
console.log('✅ SDK already initialized (Koin Application started)');
|
|
129
105
|
this.isInitialized = true;
|
|
106
|
+
// Koin can't restart — apply isProd via setEnv so interceptor picks up correct base URL
|
|
107
|
+
try {
|
|
108
|
+
await EKYCNativeModule.setEnv(isProd ? 'PROD' : 'DEV');
|
|
109
|
+
}
|
|
110
|
+
catch (_) { }
|
|
111
|
+
console.log(`✅ SDK already initialized (Koin started) — env set to ${isProd ? 'PROD' : 'DEV'}`);
|
|
130
112
|
return 'SDK already initialized (Koin Application started)';
|
|
131
113
|
}
|
|
132
114
|
console.error('❌ Failed to initialize SDK EKYC:', error);
|
|
@@ -146,6 +128,28 @@ class SDKeKYC {
|
|
|
146
128
|
throw error;
|
|
147
129
|
}
|
|
148
130
|
}
|
|
131
|
+
// Set SDK environment (DEV / PROD)
|
|
132
|
+
async setEnv(env) {
|
|
133
|
+
const nativeModule = this.ensureNativeModule();
|
|
134
|
+
try {
|
|
135
|
+
return await nativeModule.setEnv(env);
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
console.error('setEnv Error:', error);
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Get current SDK environment
|
|
143
|
+
async getEnv() {
|
|
144
|
+
const nativeModule = this.ensureNativeModule();
|
|
145
|
+
try {
|
|
146
|
+
return await nativeModule.getEnv();
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
console.error('getEnv Error:', error);
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
149
153
|
// Check if SDK is initialized
|
|
150
154
|
isSDKInitialized() {
|
|
151
155
|
return this.isInitialized;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { SDKFaceDetectStatus, SDK_LIVENESS_ACTIONS, customActionsToStrings } fro
|
|
|
14
14
|
export type { FaceServiceConfig, FaceCompareSuccessEvent, CheckFaceResponse, FaceVerifyResult } from './src/types/ekycFaceType';
|
|
15
15
|
export { EKYCEvent, EKYCErrorEvent } from './src/types/EKYCEvent';
|
|
16
16
|
export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, StartEkycUIResult, EKYCError } from './src/types/ekycType';
|
|
17
|
-
export { getEkycError, AppIDType } from './src/types/ekycType';
|
|
17
|
+
export { getEkycError, AppIDType, SDKEnv } from './src/types/ekycType';
|
|
18
18
|
export type { NfcError } from './src/types/ekycNFCType';
|
|
19
19
|
export type { OcrError } from './src/types/ekycOCRType';
|
|
20
20
|
export type { LivenessError } from './src/types/ekycLivenessType';
|
package/dist/index.js
CHANGED
|
@@ -33,9 +33,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.SDK_NAME = exports.SDK_VERSION = exports.USER_CANCEL = exports.ESIGN_INVALID_PIN_CODE = exports.ESIGN_INVALID_RECOVERY_CODE = exports.ESIGN_INVALID_LICENSE_CODE = exports.ESIGN_INVALID_CONTEXT = exports.ESIGN_MISSING_REQUEST_ID = exports.ESIGN_MISSING_SERIAL = exports.ESIGN_MISSING_IDENTITY = exports.ESIGN_MISSING_ACCESS_TOKEN = exports.ESIGN_NO_SESSION_ID = exports.ESIGN_MISSING_CONFIRMATION_DOC = exports.ESIGN_MISSING_REQUEST_JSON = exports.ESIGN_MISSING_CCCD = exports.ESIGN_MISSING_TOKEN = exports.ESIGN_ERROR_UNKNOWN = exports.ESIGN_AUTH_REQUEST_EXISTS = exports.ESIGN_INVALID_CERT_FOR_AUTH = exports.ESIGN_INVALID_SIGN_COUNT_OR_TIME = exports.ESIGN_AUTH_EXISTS = exports.ESIGN_SESSION_INVALID_LIST_CERT = exports.ESIGN_INVALID_RECOVERY_OR_PIN = exports.ESIGN_SESSION_INVALID_REGISTER = exports.ESIGN_INVALID_USER_ACCOUNT = void 0;
|
|
36
|
+
exports.OCR_FAKE_MRZ = exports.OCR_INVALID_GENDER_CODE = exports.OCR_INVALID_ID_CARD = exports.OCR_GLARE_ID_CARD = exports.OCR_BLURRY_ID_CARD = exports.OCR_CUT_CORNER_ID_CARD = exports.OCR_CANNOT_RECOGNIZE_PORTRAIT = exports.OCR_ID_CARD_FROM_OTHER_DEVICE = exports.OCR_NOT_ORIGINAL_ID_CARD = exports.OCR_MISSING_ID_CARD_PART = exports.OCR_CANNOT_GET_ISSUE_PLACE = exports.OCR_CANNOT_GET_GENDER = exports.OCR_CANNOT_GET_HOMETOWN = exports.OCR_CANNOT_GET_RESIDENCE = exports.OCR_CANNOT_GET_ISSUE_DATE = exports.OCR_CANNOT_GET_EXPIRY_DATE = exports.OCR_CANNOT_GET_BIRTH_YEAR = exports.OCR_CANNOT_GET_NAME = exports.OCR_CANNOT_GET_ID_NUMBER = exports.OCR_WRONG_ID_CARD_SIDE = exports.OCR_UNRECOGNIZED_ID_CARD = exports.SDK_MISS_KEY = exports.ERROR_UNKNOWN = exports.SDK_START_ERROR = exports.SDK_START_FLOW_ERROR = exports.getMessage = exports.getErrorResultFromDetails = exports.createCustom = exports.fromCode = exports.getLocalizedMessage = exports.parseNfcResponse = exports.AuthorizationStatus = exports.ExitConfirmGradientOrientation = exports.SDKEnv = exports.AppIDType = exports.getEkycError = exports.EKYCErrorEvent = exports.EKYCEvent = exports.customActionsToStrings = exports.SDK_LIVENESS_ACTIONS = exports.SDKFaceDetectStatus = exports.flowToStrings = exports.SDK_FLOW_OPTIONS = exports.SDKFlowType = exports.FinosESignModule = exports.FinosESign = exports.FinosEKYCModule = exports.FinosEKYC = exports.SDKeKYC = exports.sdkEKYC = void 0;
|
|
37
|
+
exports.ESIGN_DEVICE_NOT_INIT = exports.ESIGN_INVALID_LICENSE_CONTENT = exports.ESIGN_INVALID_LICENSE = exports.ESIGN_DEVICE_ALREADY_INIT = exports.ESIGN_SESSION_INVALID = exports.FETCH_HISTORY_ERROR = exports.QRCODE_ERROR = exports.SMS_OTP_RATE_LIMIT = exports.SMS_OTP_NOT_FOUND = exports.SMS_OTP_MAX_ATTEMPTS = exports.SMS_OTP_INVALID_PHONE = exports.SMS_OTP_ERROR = exports.NFC_CHIP_AUTH_FAILED = exports.NFC_USER_CANCEL = exports.NFC_UNKNOWN_ERROR = exports.NFC_IO_ERROR = exports.NFC_INVALID_MRZ_KEY = exports.NFC_CONNECTION_LOST = exports.NFC_MUTUAL_AUTH_FAILED = exports.C06_ERROR = exports.SCAN_NFC_ENABLE = exports.SCAN_NFC_CHECK = exports.SCAN_NFC_ERROR = exports.HEAD_IS_TURNED_IN_SELFIE = exports.NUDITY_DETECTED_IN_SELFIE = exports.READING_GLASSES_DETECTED_IN_SELFIE = exports.EYEWEAR_DETECTED_IN_SELFIE = exports.FACE_OCCLUDED_IN_SELFIE = exports.FACE_IS_BLURRED = exports.MASK_PRESENT_IN_SELFIE = exports.EYES_CLOSED_IN_SELFIE = exports.MULTIPLE_FACES_IN_SELFIE = exports.LIVENESS_FAIL = exports.LIVENESS_ERROR = exports.FACE_ERROR = exports.FACE_HAT_ERROR = exports.OCR_ERROR = exports.OCR_FONT_BACK_NOT_MATCH = exports.OCR_PHOTOCOPY_ID_CARD = exports.OCR_FAKE_PORTRAIT_DETECTED = exports.OCR_FAKE_CHARACTERS_DETECTED_2 = exports.OCR_FAKE_CHARACTERS_DETECTED_1 = exports.OCR_UNKNOWN_ID_NUMBER_LENGTH = exports.OCR_MODIFIED_BIRTH_DATE_DETECTED_CMND = exports.OCR_MODIFIED_SYMBOL_DETECTED_CMND = exports.OCR_FAKE_BIRTH_DATE_DETECTED_CMND = exports.OCR_FAKE_PORTRAIT_DETECTED_CMND = exports.OCR_FAKE_CHARACTERS_DETECTED_CMND = exports.OCR_USE_NEW_ID_DOCUMENT_2 = exports.OCR_USE_NEW_ID_DOCUMENT_1 = void 0;
|
|
38
|
+
exports.SDK_NAME = exports.SDK_VERSION = exports.USER_CANCEL = exports.ESIGN_INVALID_PIN_CODE = exports.ESIGN_INVALID_RECOVERY_CODE = exports.ESIGN_INVALID_LICENSE_CODE = exports.ESIGN_INVALID_CONTEXT = exports.ESIGN_MISSING_REQUEST_ID = exports.ESIGN_MISSING_SERIAL = exports.ESIGN_MISSING_IDENTITY = exports.ESIGN_MISSING_ACCESS_TOKEN = exports.ESIGN_NO_SESSION_ID = exports.ESIGN_MISSING_CONFIRMATION_DOC = exports.ESIGN_MISSING_REQUEST_JSON = exports.ESIGN_MISSING_CCCD = exports.ESIGN_MISSING_TOKEN = exports.ESIGN_ERROR_UNKNOWN = exports.ESIGN_AUTH_REQUEST_EXISTS = exports.ESIGN_INVALID_CERT_FOR_AUTH = exports.ESIGN_INVALID_SIGN_COUNT_OR_TIME = exports.ESIGN_AUTH_EXISTS = exports.ESIGN_SESSION_INVALID_LIST_CERT = exports.ESIGN_INVALID_RECOVERY_OR_PIN = exports.ESIGN_SESSION_INVALID_REGISTER = exports.ESIGN_INVALID_USER_ACCOUNT = exports.ESIGN_APP_LIMITED = void 0;
|
|
39
39
|
const EKYCModule_1 = __importStar(require("./EKYCModule"));
|
|
40
40
|
exports.sdkEKYC = EKYCModule_1.default;
|
|
41
41
|
Object.defineProperty(exports, "SDKeKYC", { enumerable: true, get: function () { return EKYCModule_1.SDKeKYC; } });
|
|
@@ -66,6 +66,7 @@ Object.defineProperty(exports, "EKYCErrorEvent", { enumerable: true, get: functi
|
|
|
66
66
|
var ekycType_1 = require("./src/types/ekycType");
|
|
67
67
|
Object.defineProperty(exports, "getEkycError", { enumerable: true, get: function () { return ekycType_1.getEkycError; } });
|
|
68
68
|
Object.defineProperty(exports, "AppIDType", { enumerable: true, get: function () { return ekycType_1.AppIDType; } });
|
|
69
|
+
Object.defineProperty(exports, "SDKEnv", { enumerable: true, get: function () { return ekycType_1.SDKEnv; } });
|
|
69
70
|
var ekycExitConfirmType_1 = require("./src/types/ekycExitConfirmType");
|
|
70
71
|
Object.defineProperty(exports, "ExitConfirmGradientOrientation", { enumerable: true, get: function () { return ekycExitConfirmType_1.ExitConfirmGradientOrientation; } });
|
|
71
72
|
var ekycESignType_1 = require("./src/types/ekycESignType");
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos_sdk/sdk-ekyc",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
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",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SDK_VERSION, SDK_NAME } from '../../EKYCModule';
|
|
2
2
|
import { NfcConfig } from '../types/ekycNFCType';
|
|
3
|
-
import { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError, AppIDType } from '../types/ekycType';
|
|
3
|
+
import { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError, AppIDType, SDKEnv } from '../types/ekycType';
|
|
4
4
|
import { C06Config } from '../types/ekycC06Type';
|
|
5
5
|
import { OcrConfig } from '../types/ekycOCRType';
|
|
6
6
|
import { LivenessConfig, SDKFaceDetectStatus, LivenessSuccessEvent } from '../types/ekycLivenessType';
|
|
@@ -43,7 +43,7 @@ export declare class FinosEKYCModule {
|
|
|
43
43
|
* Initialize the eKYC SDK
|
|
44
44
|
* Must be called before using any other methods
|
|
45
45
|
*/
|
|
46
|
-
initialize(): Promise<string>;
|
|
46
|
+
initialize(isProd?: boolean): Promise<string>;
|
|
47
47
|
/**
|
|
48
48
|
* Check if SDK is initialized
|
|
49
49
|
*/
|
|
@@ -53,6 +53,16 @@ export declare class FinosEKYCModule {
|
|
|
53
53
|
* @param transactionId Transaction ID string
|
|
54
54
|
*/
|
|
55
55
|
setTransactionId(transactionId: string): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Set SDK environment (1.5.4+).
|
|
58
|
+
* @param env SDKEnv.DEV | SDKEnv.PROD
|
|
59
|
+
*/
|
|
60
|
+
setEnv(env: SDKEnv): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Get current SDK environment (1.5.4+).
|
|
63
|
+
* @returns SDKEnv string ("DEV" | "PROD")
|
|
64
|
+
*/
|
|
65
|
+
getEnv(): Promise<string>;
|
|
56
66
|
/**
|
|
57
67
|
* Start NFC scanning for Vietnamese CCCD
|
|
58
68
|
* @param config NFC configuration
|
|
@@ -183,7 +193,7 @@ export declare class FinosEKYCModule {
|
|
|
183
193
|
/**
|
|
184
194
|
* Initialize eSign SDK
|
|
185
195
|
*/
|
|
186
|
-
initializeESign(): Promise<ESignInitResult>;
|
|
196
|
+
initializeESign(isProd?: boolean): Promise<ESignInitResult>;
|
|
187
197
|
/**
|
|
188
198
|
* Open eSign Session
|
|
189
199
|
* @param accessToken Access token (JWT)
|
|
@@ -86,7 +86,7 @@ class FinosEKYCModule {
|
|
|
86
86
|
* Initialize the eKYC SDK
|
|
87
87
|
* Must be called before using any other methods
|
|
88
88
|
*/
|
|
89
|
-
async initialize() {
|
|
89
|
+
async initialize(isProd = false) {
|
|
90
90
|
try {
|
|
91
91
|
if (this.isInitialized) {
|
|
92
92
|
console.log('✅ SDK already initialized');
|
|
@@ -98,7 +98,7 @@ class FinosEKYCModule {
|
|
|
98
98
|
console.log('✅ SDK already initialized on native side');
|
|
99
99
|
return 'SDK already initialized on native side';
|
|
100
100
|
}
|
|
101
|
-
const result = await this.sdk.initSdkEkyc();
|
|
101
|
+
const result = await this.sdk.initSdkEkyc(isProd);
|
|
102
102
|
this.isInitialized = true;
|
|
103
103
|
console.log(`✅ Finos eKYC SDK v${EKYCModule_1.SDK_VERSION} initialized successfully`);
|
|
104
104
|
return result;
|
|
@@ -137,6 +137,32 @@ class FinosEKYCModule {
|
|
|
137
137
|
throw error;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Set SDK environment (1.5.4+).
|
|
142
|
+
* @param env SDKEnv.DEV | SDKEnv.PROD
|
|
143
|
+
*/
|
|
144
|
+
async setEnv(env) {
|
|
145
|
+
try {
|
|
146
|
+
return await this.sdk.setEnv(env);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
console.error('❌ setEnv failed:', error);
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get current SDK environment (1.5.4+).
|
|
155
|
+
* @returns SDKEnv string ("DEV" | "PROD")
|
|
156
|
+
*/
|
|
157
|
+
async getEnv() {
|
|
158
|
+
try {
|
|
159
|
+
return await this.sdk.getEnv();
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
console.error('❌ getEnv failed:', error);
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
140
166
|
/**
|
|
141
167
|
* Start NFC scanning for Vietnamese CCCD
|
|
142
168
|
* @param config NFC configuration
|
|
@@ -454,11 +480,11 @@ class FinosEKYCModule {
|
|
|
454
480
|
/**
|
|
455
481
|
* Initialize eSign SDK
|
|
456
482
|
*/
|
|
457
|
-
async initializeESign() {
|
|
483
|
+
async initializeESign(isProd = false) {
|
|
458
484
|
this.validateSDKReady();
|
|
459
485
|
try {
|
|
460
486
|
console.log('🔐 Initializing eSign SDK...');
|
|
461
|
-
const result = await this.sdk.initializeESign();
|
|
487
|
+
const result = await this.sdk.initializeESign(undefined, isProd);
|
|
462
488
|
console.log('✅ eSign SDK initialized successfully');
|
|
463
489
|
return result;
|
|
464
490
|
}
|
|
@@ -773,7 +799,7 @@ const createFinosEKYCStub = () => {
|
|
|
773
799
|
});
|
|
774
800
|
// Add all other methods
|
|
775
801
|
const otherMethods = [
|
|
776
|
-
'initialize', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
|
|
802
|
+
'initialize', 'setEnv', 'getEnv', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
|
|
777
803
|
'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'openSessionId',
|
|
778
804
|
'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
|
|
779
805
|
'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
|
|
@@ -85,7 +85,7 @@ class FinosESignModule {
|
|
|
85
85
|
* Initialize the eSign SDK
|
|
86
86
|
* Must be called before using any other methods
|
|
87
87
|
*/
|
|
88
|
-
async initialize() {
|
|
88
|
+
async initialize(isProd = false) {
|
|
89
89
|
try {
|
|
90
90
|
if (this.isInitialized) {
|
|
91
91
|
console.log('✅ SDK already initialized');
|
|
@@ -97,7 +97,7 @@ class FinosESignModule {
|
|
|
97
97
|
console.log('✅ SDK already initialized on native side');
|
|
98
98
|
return 'SDK already initialized on native side';
|
|
99
99
|
}
|
|
100
|
-
const result = await this.sdk.initSdkEkyc();
|
|
100
|
+
const result = await this.sdk.initSdkEkyc(isProd);
|
|
101
101
|
this.isInitialized = true;
|
|
102
102
|
console.log(`✅ Finos eSign SDK v${EKYCModule_1.SDK_VERSION} initialized successfully`);
|
|
103
103
|
return result;
|
|
@@ -3,6 +3,14 @@ import { CheckFaceResponse } from "./ekycFaceType";
|
|
|
3
3
|
import { CheckLivenessResponse } from "./ekycLivenessType";
|
|
4
4
|
import { CheckOcrResponse } from "./ekycOCRType";
|
|
5
5
|
import { SDKTransactionResponse } from "./ekycTransactionType";
|
|
6
|
+
/**
|
|
7
|
+
* SDKEnv – môi trường hoạt động của SDK (1.5.4+).
|
|
8
|
+
* Map native: Android SDKEnv.DEV / PROD.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum SDKEnv {
|
|
11
|
+
DEV = "DEV",
|
|
12
|
+
PROD = "PROD"
|
|
13
|
+
}
|
|
6
14
|
/**
|
|
7
15
|
* AppIDType – loại app ID truyền vào SDK.
|
|
8
16
|
* Map native: Android AppIDType.NONE / AppIDType.HD_BANK / AppIDType.VIKKI,
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppIDType = void 0;
|
|
3
|
+
exports.AppIDType = exports.SDKEnv = void 0;
|
|
4
4
|
exports.getEkycError = getEkycError;
|
|
5
|
+
/**
|
|
6
|
+
* SDKEnv – môi trường hoạt động của SDK (1.5.4+).
|
|
7
|
+
* Map native: Android SDKEnv.DEV / PROD.
|
|
8
|
+
*/
|
|
9
|
+
var SDKEnv;
|
|
10
|
+
(function (SDKEnv) {
|
|
11
|
+
SDKEnv["DEV"] = "DEV";
|
|
12
|
+
SDKEnv["PROD"] = "PROD";
|
|
13
|
+
})(SDKEnv || (exports.SDKEnv = SDKEnv = {}));
|
|
5
14
|
/**
|
|
6
15
|
* AppIDType – loại app ID truyền vào SDK.
|
|
7
16
|
* Map native: Android AppIDType.NONE / AppIDType.HD_BANK / AppIDType.VIKKI,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos_sdk/sdk-ekyc",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
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",
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Platform, DeviceEventEmitter } from 'react-native';
|
|
3
3
|
import sdkEKYC, { SDKeKYC, SDK_VERSION, SDK_NAME } from '../../EKYCModule';
|
|
4
4
|
import { NfcConfig, NfcError } from '../types/ekycNFCType';
|
|
5
|
-
import { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError, getEkycError, AppIDType } from '../types/ekycType';
|
|
5
|
+
import { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError, getEkycError, AppIDType, SDKEnv } from '../types/ekycType';
|
|
6
6
|
import { C06Config } from '../types/ekycC06Type';
|
|
7
7
|
import { OcrConfig, OcrError } from '../types/ekycOCRType';
|
|
8
8
|
import { LivenessConfig, SDKFaceDetectStatus, LivenessError, LivenessSuccessEvent } from '../types/ekycLivenessType';
|
|
@@ -75,7 +75,7 @@ export class FinosEKYCModule {
|
|
|
75
75
|
* Initialize the eKYC SDK
|
|
76
76
|
* Must be called before using any other methods
|
|
77
77
|
*/
|
|
78
|
-
public async initialize(): Promise<string> {
|
|
78
|
+
public async initialize(isProd: boolean = false): Promise<string> {
|
|
79
79
|
try {
|
|
80
80
|
if (this.isInitialized) {
|
|
81
81
|
console.log('✅ SDK already initialized');
|
|
@@ -89,7 +89,7 @@ export class FinosEKYCModule {
|
|
|
89
89
|
return 'SDK already initialized on native side';
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
const result = await this.sdk.initSdkEkyc();
|
|
92
|
+
const result = await this.sdk.initSdkEkyc(isProd);
|
|
93
93
|
this.isInitialized = true;
|
|
94
94
|
console.log(`✅ Finos eKYC SDK v${SDK_VERSION} initialized successfully`);
|
|
95
95
|
return result;
|
|
@@ -131,6 +131,32 @@ export class FinosEKYCModule {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Set SDK environment (1.5.4+).
|
|
136
|
+
* @param env SDKEnv.DEV | SDKEnv.PROD
|
|
137
|
+
*/
|
|
138
|
+
public async setEnv(env: SDKEnv): Promise<string> {
|
|
139
|
+
try {
|
|
140
|
+
return await this.sdk.setEnv(env);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
console.error('❌ setEnv failed:', error);
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get current SDK environment (1.5.4+).
|
|
149
|
+
* @returns SDKEnv string ("DEV" | "PROD")
|
|
150
|
+
*/
|
|
151
|
+
public async getEnv(): Promise<string> {
|
|
152
|
+
try {
|
|
153
|
+
return await this.sdk.getEnv();
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.error('❌ getEnv failed:', error);
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
134
160
|
/**
|
|
135
161
|
* Start NFC scanning for Vietnamese CCCD
|
|
136
162
|
* @param config NFC configuration
|
|
@@ -486,12 +512,12 @@ export class FinosEKYCModule {
|
|
|
486
512
|
/**
|
|
487
513
|
* Initialize eSign SDK
|
|
488
514
|
*/
|
|
489
|
-
public async initializeESign(): Promise<ESignInitResult> {
|
|
515
|
+
public async initializeESign(isProd: boolean = false): Promise<ESignInitResult> {
|
|
490
516
|
this.validateSDKReady();
|
|
491
517
|
|
|
492
518
|
try {
|
|
493
519
|
console.log('🔐 Initializing eSign SDK...');
|
|
494
|
-
const result = await this.sdk.initializeESign();
|
|
520
|
+
const result = await this.sdk.initializeESign(undefined, isProd);
|
|
495
521
|
console.log('✅ eSign SDK initialized successfully');
|
|
496
522
|
return result;
|
|
497
523
|
} catch (error) {
|
|
@@ -948,7 +974,7 @@ const createFinosEKYCStub = (): FinosEKYCModule => {
|
|
|
948
974
|
|
|
949
975
|
// Add all other methods
|
|
950
976
|
const otherMethods = [
|
|
951
|
-
'initialize', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
|
|
977
|
+
'initialize', 'setEnv', 'getEnv', 'startNfcScan', 'checkC06', 'startOcr', 'startLiveness', 'startFaceCompare',
|
|
952
978
|
'startEkycUI', 'sendOtp', 'verifyOtp', 'resendOtp', 'initializeESign', 'openSessionId',
|
|
953
979
|
'registerDevice', 'listCerts', 'verifyCert', 'listSignRequest', 'confirmSign',
|
|
954
980
|
'registerRemoteSigning', 'signPdf', 'sendConfirmationDocument',
|
|
@@ -69,7 +69,7 @@ export class FinosESignModule {
|
|
|
69
69
|
* Initialize the eSign SDK
|
|
70
70
|
* Must be called before using any other methods
|
|
71
71
|
*/
|
|
72
|
-
public async initialize(): Promise<string> {
|
|
72
|
+
public async initialize(isProd: boolean = false): Promise<string> {
|
|
73
73
|
try {
|
|
74
74
|
if (this.isInitialized) {
|
|
75
75
|
console.log('✅ SDK already initialized');
|
|
@@ -83,7 +83,7 @@ export class FinosESignModule {
|
|
|
83
83
|
return 'SDK already initialized on native side';
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const result = await this.sdk.initSdkEkyc();
|
|
86
|
+
const result = await this.sdk.initSdkEkyc(isProd);
|
|
87
87
|
this.isInitialized = true;
|
|
88
88
|
console.log(`✅ Finos eSign SDK v${SDK_VERSION} initialized successfully`);
|
|
89
89
|
return result;
|
package/src/types/ekycType.ts
CHANGED
|
@@ -4,6 +4,15 @@ import { CheckLivenessResponse } from "./ekycLivenessType";
|
|
|
4
4
|
import { CheckOcrResponse } from "./ekycOCRType";
|
|
5
5
|
import { SDKTransactionResponse } from "./ekycTransactionType";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* SDKEnv – môi trường hoạt động của SDK (1.5.4+).
|
|
9
|
+
* Map native: Android SDKEnv.DEV / PROD.
|
|
10
|
+
*/
|
|
11
|
+
export enum SDKEnv {
|
|
12
|
+
DEV = "DEV",
|
|
13
|
+
PROD = "PROD",
|
|
14
|
+
}
|
|
15
|
+
|
|
7
16
|
/**
|
|
8
17
|
* AppIDType – loại app ID truyền vào SDK.
|
|
9
18
|
* Map native: Android AppIDType.NONE / AppIDType.HD_BANK / AppIDType.VIKKI,
|
package/dist/dist/package.json
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@finos_sdk/sdk-ekyc",
|
|
3
|
-
"version": "1.5.3",
|
|
4
|
-
"description": "React Native SDK for eKYC - Vietnamese CCCD NFC reading, OCR, Liveness detection, Face matching, and C06, eSign, SmsOTP residence verification",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist",
|
|
9
|
-
"react-native.config.js",
|
|
10
|
-
"android/src/main/java",
|
|
11
|
-
"android/build.gradle",
|
|
12
|
-
"android/settings.gradle",
|
|
13
|
-
"android/gradle.properties",
|
|
14
|
-
"android/gradle/wrapper/**",
|
|
15
|
-
"android/gradlew",
|
|
16
|
-
"android/gradlew.bat",
|
|
17
|
-
"android/consumer-rules.pro",
|
|
18
|
-
"ios/**",
|
|
19
|
-
"finos-ekyc-sdk.podspec",
|
|
20
|
-
"src/**"
|
|
21
|
-
],
|
|
22
|
-
"repository": {
|
|
23
|
-
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/finosvn/finos.ekyc.sdk.git"
|
|
25
|
-
},
|
|
26
|
-
"author": "FinOS",
|
|
27
|
-
"license": "MIT",
|
|
28
|
-
"bugs": {
|
|
29
|
-
"url": "https://github.com/finosvn/finos.ekyc.sdk/issues"
|
|
30
|
-
},
|
|
31
|
-
"homepage": "https://github.com/finosvn/finos.ekyc.sdk#readme",
|
|
32
|
-
"keywords": [
|
|
33
|
-
"react-native",
|
|
34
|
-
"ekyc",
|
|
35
|
-
"nfc",
|
|
36
|
-
"ocr",
|
|
37
|
-
"liveness",
|
|
38
|
-
"face-matching",
|
|
39
|
-
"vietnamese",
|
|
40
|
-
"cccd",
|
|
41
|
-
"identity-verification",
|
|
42
|
-
"finos-sdk",
|
|
43
|
-
"android",
|
|
44
|
-
"typescript"
|
|
45
|
-
],
|
|
46
|
-
"scripts": {
|
|
47
|
-
"clear": "rm -rf node_modules dist package-lock.json && npm cache clean --force && (cd android && ./gradlew clean 2>/dev/null) || true",
|
|
48
|
-
"npm-install": "npm install",
|
|
49
|
-
"npm-install-legacy": "npm install --legacy-peer-deps",
|
|
50
|
-
"build": "tsc && mkdir -p dist && cp package.json dist/",
|
|
51
|
-
"publish-sdk-local": "npm run build && npm pack",
|
|
52
|
-
"publish-sdk": "npm run build && npm publish --access public",
|
|
53
|
-
"publish-sdk-version": "npm run build && npm version patch --force && npm publish --access public"
|
|
54
|
-
},
|
|
55
|
-
"peerDependencies": {
|
|
56
|
-
"react": ">=18.0.0",
|
|
57
|
-
"react-native": ">=0.70.0"
|
|
58
|
-
},
|
|
59
|
-
"dependencies": {
|
|
60
|
-
"reflect-metadata": "^0.2.1",
|
|
61
|
-
"tsyringe": "^4.10.0"
|
|
62
|
-
},
|
|
63
|
-
"devDependencies": {
|
|
64
|
-
"@babel/core": "^7.25.2",
|
|
65
|
-
"@babel/preset-env": "^7.25.3",
|
|
66
|
-
"@babel/runtime": "^7.25.0",
|
|
67
|
-
"@react-native-community/cli": "16.0.3",
|
|
68
|
-
"@react-native/babel-preset": "0.77.0",
|
|
69
|
-
"@react-native/eslint-config": "0.77.0",
|
|
70
|
-
"@react-native/metro-config": "0.77.0",
|
|
71
|
-
"@react-native/typescript-config": "0.77.0",
|
|
72
|
-
"@types/react": "18.2.6",
|
|
73
|
-
"@types/react-test-renderer": "18.0.0",
|
|
74
|
-
"babel-jest": "^29.6.3",
|
|
75
|
-
"eslint": "^8.19.0",
|
|
76
|
-
"jest": "^29.6.3",
|
|
77
|
-
"prettier": "2.8.8",
|
|
78
|
-
"react": "18.2.0",
|
|
79
|
-
"react-native": "0.73.0",
|
|
80
|
-
"react-test-renderer": "18.2.0",
|
|
81
|
-
"typescript": "^5.0.4"
|
|
82
|
-
},
|
|
83
|
-
"engines": {
|
|
84
|
-
"node": ">=18"
|
|
85
|
-
}
|
|
86
|
-
}
|