@finos_sdk/sdk-ekyc 1.5.2 → 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 +58 -27
- package/dist/EKYCModule.d.ts +10 -8
- 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 +20 -10
- package/dist/src/modules/FinosEKYCModule.js +31 -5
- package/dist/src/modules/FinosESignModule.d.ts +9 -9
- package/dist/src/modules/FinosESignModule.js +2 -2
- package/dist/src/types/ekycSmsOtpType.d.ts +28 -7
- package/dist/src/types/ekycType.d.ts +8 -0
- package/dist/src/types/ekycType.js +10 -1
- package/ios/.xcode.env.local +2 -0
- package/package.json +1 -1
- package/src/modules/FinosEKYCModule.ts +39 -13
- package/src/modules/FinosESignModule.ts +10 -10
- package/src/types/ekycSmsOtpType.ts +30 -8
- package/src/types/ekycType.ts +9 -0
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")
|
|
@@ -565,6 +565,28 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
565
565
|
.emit(eventName, params)
|
|
566
566
|
}
|
|
567
567
|
|
|
568
|
+
private fun WritableMap.putCustomData(customData: Map<*, *>?) {
|
|
569
|
+
customData?.forEach { (key, value) ->
|
|
570
|
+
val k = key.toString()
|
|
571
|
+
when (value) {
|
|
572
|
+
is Boolean -> putBoolean(k, value)
|
|
573
|
+
is Int -> putInt(k, value)
|
|
574
|
+
is Long -> putInt(k, value.toInt())
|
|
575
|
+
is Double -> putDouble(k, value)
|
|
576
|
+
else -> {
|
|
577
|
+
val str = value.toString()
|
|
578
|
+
val intVal = str.toIntOrNull()
|
|
579
|
+
val boolVal = str.lowercase().toBooleanStrictOrNull()
|
|
580
|
+
when {
|
|
581
|
+
boolVal != null -> putBoolean(k, boolVal)
|
|
582
|
+
intVal != null -> putInt(k, intVal)
|
|
583
|
+
else -> putString(k, str)
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
568
590
|
/**
|
|
569
591
|
* Helper function to create separate maps for event and promise to avoid "Map already consumed" error
|
|
570
592
|
* @param builder Lambda function to build the map content
|
|
@@ -711,10 +733,10 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
711
733
|
}
|
|
712
734
|
|
|
713
735
|
@ReactMethod
|
|
714
|
-
fun initSdkEkyc(promise: Promise) {
|
|
715
|
-
Log.d(TAG, "▶️ initSdkEkyc() called")
|
|
736
|
+
fun initSdkEkyc(isProd: Boolean, promise: Promise) {
|
|
737
|
+
Log.d(TAG, "▶️ initSdkEkyc() called, isProd: $isProd")
|
|
716
738
|
try {
|
|
717
|
-
eKYCFinOS.initSDKEkyc(reactApplicationContext) {
|
|
739
|
+
eKYCFinOS.initSDKEkyc(reactApplicationContext, isProd) {
|
|
718
740
|
Log.d(TAG, "✅ initSdkEkyc() success")
|
|
719
741
|
val params =
|
|
720
742
|
Arguments.createMap().apply {
|
|
@@ -755,6 +777,36 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
755
777
|
}
|
|
756
778
|
}
|
|
757
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
|
+
|
|
758
810
|
@ReactMethod
|
|
759
811
|
fun startNfcScan(
|
|
760
812
|
appKey: String,
|
|
@@ -1891,14 +1943,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
1891
1943
|
callbackSuccess = { event, result ->
|
|
1892
1944
|
Log.d(TAG, "✅ sendOtp() success")
|
|
1893
1945
|
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1894
|
-
map.
|
|
1895
|
-
result?.let {
|
|
1896
|
-
val dataMap = Arguments.createMap()
|
|
1897
|
-
it.customData?.forEach { (key, value) ->
|
|
1898
|
-
dataMap.putString(key, value.toString())
|
|
1899
|
-
}
|
|
1900
|
-
map.putMap("data", dataMap)
|
|
1901
|
-
}
|
|
1946
|
+
map.putCustomData(result?.customData)
|
|
1902
1947
|
}
|
|
1903
1948
|
sendEvent("onSmsOtpSendSuccess", eventMap)
|
|
1904
1949
|
promise.resolve(promiseMap)
|
|
@@ -1952,14 +1997,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
1952
1997
|
callbackSuccess = { event, result ->
|
|
1953
1998
|
Log.d(TAG, "✅ verifyOtp() success")
|
|
1954
1999
|
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
1955
|
-
map.
|
|
1956
|
-
result?.let {
|
|
1957
|
-
val dataMap = Arguments.createMap()
|
|
1958
|
-
it.customData?.forEach { (key, value) ->
|
|
1959
|
-
dataMap.putString(key, value.toString())
|
|
1960
|
-
}
|
|
1961
|
-
map.putMap("data", dataMap)
|
|
1962
|
-
}
|
|
2000
|
+
map.putCustomData(result?.customData)
|
|
1963
2001
|
}
|
|
1964
2002
|
sendEvent("onSmsOtpVerifySuccess", eventMap)
|
|
1965
2003
|
promise.resolve(promiseMap)
|
|
@@ -2011,14 +2049,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
2011
2049
|
callbackSuccess = { event, result ->
|
|
2012
2050
|
Log.d(TAG, "✅ resendOtp() success")
|
|
2013
2051
|
val (eventMap, promiseMap) = createSeparateMaps { map ->
|
|
2014
|
-
map.
|
|
2015
|
-
result?.let {
|
|
2016
|
-
val dataMap = Arguments.createMap()
|
|
2017
|
-
it.customData?.forEach { (key, value) ->
|
|
2018
|
-
dataMap.putString(key, value.toString())
|
|
2019
|
-
}
|
|
2020
|
-
map.putMap("data", dataMap)
|
|
2021
|
-
}
|
|
2052
|
+
map.putCustomData(result?.customData)
|
|
2022
2053
|
}
|
|
2023
2054
|
sendEvent("onSmsOtpResendSuccess", eventMap)
|
|
2024
2055
|
promise.resolve(promiseMap)
|
package/dist/EKYCModule.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { C06Config } from './src/types/ekycC06Type';
|
|
|
5
5
|
import { OcrConfig } from './src/types/ekycOCRType';
|
|
6
6
|
import { LivenessConfig, SDKFaceDetectStatus, LivenessSuccessEvent } from './src/types/ekycLivenessType';
|
|
7
7
|
import { FaceServiceConfig, FaceCompareSuccessEvent } from './src/types/ekycFaceType';
|
|
8
|
-
import { SmsOtpConfig,
|
|
8
|
+
import { SmsOtpConfig, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from './src/types/ekycSmsOtpType';
|
|
9
9
|
import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, AuthorizeInfo, ESignPdfResult, ESignApiResponse } from './src/types/ekycESignType';
|
|
10
10
|
import { ExitConfirmConfig } from './src/types/ekycExitConfirmType';
|
|
11
11
|
export declare const SDK_VERSION: string;
|
|
@@ -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;
|
|
@@ -48,12 +50,12 @@ declare class SDKeKYC {
|
|
|
48
50
|
onEkycUISuccess(callback: (data: any) => void): EmitterSubscription | null;
|
|
49
51
|
onEkycUIError(callback: (error: any) => void): EmitterSubscription | null;
|
|
50
52
|
removeAllListeners(): void;
|
|
51
|
-
sendOtp(config: SmsOtpConfig): Promise<
|
|
52
|
-
verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<
|
|
53
|
-
resendOtp(config: SmsOtpConfig): Promise<
|
|
54
|
-
onSmsOtpSendSuccess(callback: (data:
|
|
55
|
-
onSmsOtpVerifySuccess(callback: (data:
|
|
56
|
-
onSmsOtpResendSuccess(callback: (data:
|
|
53
|
+
sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse>;
|
|
54
|
+
verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse>;
|
|
55
|
+
resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse>;
|
|
56
|
+
onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void): EmitterSubscription | null;
|
|
57
|
+
onSmsOtpVerifySuccess(callback: (data: VerifyOtpResponse) => void): EmitterSubscription | null;
|
|
58
|
+
onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void): EmitterSubscription | null;
|
|
57
59
|
onSmsOtpError(callback: (error: SmsOtpError) => void): EmitterSubscription | null;
|
|
58
60
|
initializeESign(finosToken?: string | null, isProd?: boolean): Promise<ESignInitResult>;
|
|
59
61
|
getSdkToken(identity: string, name: string, deviceId: string): Promise<string>;
|
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,11 +1,11 @@
|
|
|
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';
|
|
7
7
|
import { FaceServiceConfig, FaceCompareSuccessEvent } from '../types/ekycFaceType';
|
|
8
|
-
import { SmsOtpConfig,
|
|
8
|
+
import { SmsOtpConfig, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
9
9
|
import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignPdfResult, ESignApiResponse } from '../types/ekycESignType';
|
|
10
10
|
import { SDKFlowType } from '../types/ekycFlowType';
|
|
11
11
|
import { ExitConfirmConfig } from '../types/ekycExitConfirmType';
|
|
@@ -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
|
|
@@ -164,26 +174,26 @@ export declare class FinosEKYCModule {
|
|
|
164
174
|
* Send SMS OTP
|
|
165
175
|
* @param config SMS OTP configuration
|
|
166
176
|
*/
|
|
167
|
-
sendOtp(config: SmsOtpConfig): Promise<
|
|
177
|
+
sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse>;
|
|
168
178
|
/**
|
|
169
179
|
* Verify SMS OTP
|
|
170
180
|
* @param config SMS OTP configuration (must include requestId)
|
|
171
181
|
* @param otpCode OTP code from SMS
|
|
172
182
|
*/
|
|
173
|
-
verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<
|
|
183
|
+
verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse>;
|
|
174
184
|
/**
|
|
175
185
|
* Resend SMS OTP
|
|
176
186
|
* @param config SMS OTP configuration (must include requestId)
|
|
177
187
|
*/
|
|
178
|
-
resendOtp(config: SmsOtpConfig): Promise<
|
|
179
|
-
onSmsOtpSendSuccess(callback: (data:
|
|
180
|
-
onSmsOtpResendSuccess(callback: (data:
|
|
188
|
+
resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse>;
|
|
189
|
+
onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void): import("react-native").EmitterSubscription | null;
|
|
190
|
+
onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void): import("react-native").EmitterSubscription | null;
|
|
181
191
|
/** Payload là EKYCError: { event, code, message }. */
|
|
182
192
|
onSmsOtpError(callback: (error: EKYCError) => void): import("react-native").EmitterSubscription | null;
|
|
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)
|
|
@@ -375,7 +385,7 @@ export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
|
375
385
|
export type { FaceServiceConfig, FaceCompareError } from '../types/ekycFaceType';
|
|
376
386
|
export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError } from '../types/ekycType';
|
|
377
387
|
export { getEkycError, AppIDType } from '../types/ekycType';
|
|
378
|
-
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
388
|
+
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
379
389
|
export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
|
|
380
390
|
export { SDK_VERSION, SDK_NAME };
|
|
381
391
|
export default FinosEKYC;
|
|
@@ -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',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SDK_VERSION, SDK_NAME } from '../../EKYCModule';
|
|
2
|
-
import { SmsOtpConfig,
|
|
2
|
+
import { SmsOtpConfig, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
3
3
|
import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, AuthorizeInfo, ESignPdfResult, ESignApiResponse } from '../types/ekycESignType';
|
|
4
4
|
import { LivenessConfig, LivenessSuccessEvent } from '../types/ekycLivenessType';
|
|
5
5
|
import { FaceServiceConfig, FaceCompareSuccessEvent } from '../types/ekycFaceType';
|
|
@@ -38,7 +38,7 @@ export declare class FinosESignModule {
|
|
|
38
38
|
* Initialize the eSign SDK
|
|
39
39
|
* Must be called before using any other methods
|
|
40
40
|
*/
|
|
41
|
-
initialize(): Promise<string>;
|
|
41
|
+
initialize(isProd?: boolean): Promise<string>;
|
|
42
42
|
/**
|
|
43
43
|
* Check if SDK is initialized
|
|
44
44
|
*/
|
|
@@ -47,21 +47,21 @@ export declare class FinosESignModule {
|
|
|
47
47
|
* Send SMS OTP
|
|
48
48
|
* @param config SMS OTP configuration
|
|
49
49
|
*/
|
|
50
|
-
sendOtp(config: SmsOtpConfig): Promise<
|
|
50
|
+
sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse>;
|
|
51
51
|
/**
|
|
52
52
|
* Verify SMS OTP
|
|
53
53
|
* @param config SMS OTP configuration (must include requestId)
|
|
54
54
|
* @param otpCode OTP code from SMS
|
|
55
55
|
*/
|
|
56
|
-
verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<
|
|
56
|
+
verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse>;
|
|
57
57
|
/**
|
|
58
58
|
* Resend SMS OTP
|
|
59
59
|
* @param config SMS OTP configuration (must include requestId)
|
|
60
60
|
*/
|
|
61
|
-
resendOtp(config: SmsOtpConfig): Promise<
|
|
62
|
-
onSmsOtpSendSuccess(callback: (data:
|
|
63
|
-
onSmsOtpVerifySuccess(callback: (data:
|
|
64
|
-
onSmsOtpResendSuccess(callback: (data:
|
|
61
|
+
resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse>;
|
|
62
|
+
onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void): import("react-native").EmitterSubscription | null;
|
|
63
|
+
onSmsOtpVerifySuccess(callback: (data: VerifyOtpResponse) => void): import("react-native").EmitterSubscription | null;
|
|
64
|
+
onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void): import("react-native").EmitterSubscription | null;
|
|
65
65
|
/** Payload là EKYCError: { event, code, message }. */
|
|
66
66
|
onSmsOtpError(callback: (error: EKYCError) => void): import("react-native").EmitterSubscription | null;
|
|
67
67
|
/**
|
|
@@ -329,7 +329,7 @@ export declare class FinosESignModule {
|
|
|
329
329
|
private validateSDKReady;
|
|
330
330
|
}
|
|
331
331
|
export declare const FinosESign: FinosESignModule;
|
|
332
|
-
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
332
|
+
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
333
333
|
export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult, AuthorizeInfo, ESignApiResponse } from '../types/ekycESignType';
|
|
334
334
|
export type { LivenessConfig, LivenessError } from '../types/ekycLivenessType';
|
|
335
335
|
export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
@@ -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;
|
|
@@ -26,16 +26,10 @@ export interface SmsOtpConfig {
|
|
|
26
26
|
/** SMS OTP error – dùng chung EKYCError (event, code, message). */
|
|
27
27
|
export type SmsOtpError = import('./ekycType').EKYCError;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* @deprecated Use SendOtpResponse, VerifyOtpResponse, or ResendOtpResponse instead.
|
|
30
30
|
*/
|
|
31
31
|
export interface SmsOtpResult {
|
|
32
|
-
/**
|
|
33
|
-
* Event type
|
|
34
|
-
*/
|
|
35
32
|
event: string;
|
|
36
|
-
/**
|
|
37
|
-
* Response data
|
|
38
|
-
*/
|
|
39
33
|
data?: {
|
|
40
34
|
requestId?: string;
|
|
41
35
|
expiresIn?: string;
|
|
@@ -43,3 +37,30 @@ export interface SmsOtpResult {
|
|
|
43
37
|
[key: string]: any;
|
|
44
38
|
};
|
|
45
39
|
}
|
|
40
|
+
interface BaseOtpResponse {
|
|
41
|
+
success?: boolean;
|
|
42
|
+
requestId?: string;
|
|
43
|
+
expiresIn?: number;
|
|
44
|
+
resendAfter?: number;
|
|
45
|
+
error?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SendOtpResponse extends BaseOtpResponse {
|
|
48
|
+
}
|
|
49
|
+
export interface VerifyOtpResponse {
|
|
50
|
+
success?: boolean;
|
|
51
|
+
verified?: boolean;
|
|
52
|
+
verifiedAt?: string;
|
|
53
|
+
attemptsRemaining?: number;
|
|
54
|
+
error?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ResendOtpResponse extends BaseOtpResponse {
|
|
57
|
+
attemptsRemaining?: number;
|
|
58
|
+
statusCode?: number;
|
|
59
|
+
errorCode?: string;
|
|
60
|
+
message?: string;
|
|
61
|
+
retryAfter?: number;
|
|
62
|
+
retryAt?: string;
|
|
63
|
+
cooldownSeconds?: number;
|
|
64
|
+
elapsedSeconds?: number;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -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,12 +2,12 @@ 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';
|
|
9
9
|
import { FaceServiceConfig, FaceCompareError, FaceCompareSuccessEvent } from '../types/ekycFaceType';
|
|
10
|
-
import { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
10
|
+
import { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
11
11
|
import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult, ESignPdfResult, ESignApiResponse } from '../types/ekycESignType';
|
|
12
12
|
import { SDKFlowType, flowToStrings } from '../types/ekycFlowType';
|
|
13
13
|
import { ExitConfirmConfig } from '../types/ekycExitConfirmType';
|
|
@@ -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
|
|
@@ -404,7 +430,7 @@ export class FinosEKYCModule {
|
|
|
404
430
|
* Send SMS OTP
|
|
405
431
|
* @param config SMS OTP configuration
|
|
406
432
|
*/
|
|
407
|
-
public async sendOtp(config: SmsOtpConfig): Promise<
|
|
433
|
+
public async sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse> {
|
|
408
434
|
this.validateSDKReady();
|
|
409
435
|
|
|
410
436
|
try {
|
|
@@ -423,7 +449,7 @@ export class FinosEKYCModule {
|
|
|
423
449
|
* @param config SMS OTP configuration (must include requestId)
|
|
424
450
|
* @param otpCode OTP code from SMS
|
|
425
451
|
*/
|
|
426
|
-
public async verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<
|
|
452
|
+
public async verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse> {
|
|
427
453
|
this.validateSDKReady();
|
|
428
454
|
|
|
429
455
|
try {
|
|
@@ -441,7 +467,7 @@ export class FinosEKYCModule {
|
|
|
441
467
|
* Resend SMS OTP
|
|
442
468
|
* @param config SMS OTP configuration (must include requestId)
|
|
443
469
|
*/
|
|
444
|
-
public async resendOtp(config: SmsOtpConfig): Promise<
|
|
470
|
+
public async resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse> {
|
|
445
471
|
this.validateSDKReady();
|
|
446
472
|
|
|
447
473
|
try {
|
|
@@ -456,7 +482,7 @@ export class FinosEKYCModule {
|
|
|
456
482
|
}
|
|
457
483
|
|
|
458
484
|
// SMS OTP Event Listeners
|
|
459
|
-
public onSmsOtpSendSuccess(callback: (data:
|
|
485
|
+
public onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void) {
|
|
460
486
|
const listener = this.sdk.onSmsOtpSendSuccess(callback);
|
|
461
487
|
if (!listener) {
|
|
462
488
|
console.warn('⚠️ onSmsOtpSendSuccess: Event emitter not ready. Make sure SDK is initialized.');
|
|
@@ -464,7 +490,7 @@ export class FinosEKYCModule {
|
|
|
464
490
|
return listener;
|
|
465
491
|
}
|
|
466
492
|
|
|
467
|
-
public onSmsOtpResendSuccess(callback: (data:
|
|
493
|
+
public onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void) {
|
|
468
494
|
const listener = this.sdk.onSmsOtpResendSuccess(callback);
|
|
469
495
|
if (!listener) {
|
|
470
496
|
console.warn('⚠️ onSmsOtpResendSuccess: Event emitter not ready.');
|
|
@@ -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',
|
|
@@ -1049,7 +1075,7 @@ export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
|
1049
1075
|
export type { FaceServiceConfig, FaceCompareError } from '../types/ekycFaceType';
|
|
1050
1076
|
export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError } from '../types/ekycType';
|
|
1051
1077
|
export { getEkycError, AppIDType } from '../types/ekycType';
|
|
1052
|
-
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
1078
|
+
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
1053
1079
|
export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
|
|
1054
1080
|
|
|
1055
1081
|
// Export constants
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import sdkEKYC, { SDKeKYC, SDK_VERSION, SDK_NAME } from '../../EKYCModule';
|
|
3
|
-
import { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
3
|
+
import { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
4
4
|
import { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult, AuthorizeInfo, ESignPdfResult, ESignApiResponse } from '../types/ekycESignType';
|
|
5
5
|
import { LivenessConfig, LivenessError, LivenessSuccessEvent } from '../types/ekycLivenessType';
|
|
6
6
|
import { FaceServiceConfig, FaceCompareError, FaceCompareSuccessEvent } from '../types/ekycFaceType';
|
|
@@ -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;
|
|
@@ -113,7 +113,7 @@ export class FinosESignModule {
|
|
|
113
113
|
* Send SMS OTP
|
|
114
114
|
* @param config SMS OTP configuration
|
|
115
115
|
*/
|
|
116
|
-
public async sendOtp(config: SmsOtpConfig): Promise<
|
|
116
|
+
public async sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse> {
|
|
117
117
|
this.validateSDKReady();
|
|
118
118
|
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
119
119
|
return await this.sdk.sendOtp(config);
|
|
@@ -124,7 +124,7 @@ export class FinosESignModule {
|
|
|
124
124
|
* @param config SMS OTP configuration (must include requestId)
|
|
125
125
|
* @param otpCode OTP code from SMS
|
|
126
126
|
*/
|
|
127
|
-
public async verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<
|
|
127
|
+
public async verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse> {
|
|
128
128
|
this.validateSDKReady();
|
|
129
129
|
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
130
130
|
return await this.sdk.verifyOtp(config, otpCode);
|
|
@@ -134,14 +134,14 @@ export class FinosESignModule {
|
|
|
134
134
|
* Resend SMS OTP
|
|
135
135
|
* @param config SMS OTP configuration (must include requestId)
|
|
136
136
|
*/
|
|
137
|
-
public async resendOtp(config: SmsOtpConfig): Promise<
|
|
137
|
+
public async resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse> {
|
|
138
138
|
this.validateSDKReady();
|
|
139
139
|
// Pass through to SDK - error handling is done in EKYCModule.ts
|
|
140
140
|
return await this.sdk.resendOtp(config);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
// SMS OTP Event Listeners
|
|
144
|
-
public onSmsOtpSendSuccess(callback: (data:
|
|
144
|
+
public onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void) {
|
|
145
145
|
const listener = this.sdk.onSmsOtpSendSuccess(callback);
|
|
146
146
|
if (!listener) {
|
|
147
147
|
console.warn('⚠️ onSmsOtpSendSuccess: Event emitter not ready. Make sure SDK is initialized.');
|
|
@@ -149,7 +149,7 @@ export class FinosESignModule {
|
|
|
149
149
|
return listener;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
public onSmsOtpVerifySuccess(callback: (data:
|
|
152
|
+
public onSmsOtpVerifySuccess(callback: (data: VerifyOtpResponse) => void) {
|
|
153
153
|
const listener = this.sdk.onSmsOtpVerifySuccess(callback);
|
|
154
154
|
if (!listener) {
|
|
155
155
|
console.warn('⚠️ onSmsOtpVerifySuccess: Event emitter not ready.');
|
|
@@ -157,7 +157,7 @@ export class FinosESignModule {
|
|
|
157
157
|
return listener;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
public onSmsOtpResendSuccess(callback: (data:
|
|
160
|
+
public onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void) {
|
|
161
161
|
const listener = this.sdk.onSmsOtpResendSuccess(callback);
|
|
162
162
|
if (!listener) {
|
|
163
163
|
console.warn('⚠️ onSmsOtpResendSuccess: Event emitter not ready.');
|
|
@@ -892,7 +892,7 @@ const createFinosESignWrapper = (): FinosESignModule => {
|
|
|
892
892
|
export const FinosESign = createFinosESignWrapper();
|
|
893
893
|
|
|
894
894
|
// Export types
|
|
895
|
-
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
895
|
+
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
896
896
|
export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult, AuthorizeInfo, ESignApiResponse } from '../types/ekycESignType';
|
|
897
897
|
export type { LivenessConfig, LivenessError } from '../types/ekycLivenessType';
|
|
898
898
|
export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
@@ -32,17 +32,10 @@ export interface SmsOtpConfig {
|
|
|
32
32
|
export type SmsOtpError = import('./ekycType').EKYCError;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* @deprecated Use SendOtpResponse, VerifyOtpResponse, or ResendOtpResponse instead.
|
|
36
36
|
*/
|
|
37
37
|
export interface SmsOtpResult {
|
|
38
|
-
/**
|
|
39
|
-
* Event type
|
|
40
|
-
*/
|
|
41
38
|
event: string;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Response data
|
|
45
|
-
*/
|
|
46
39
|
data?: {
|
|
47
40
|
requestId?: string;
|
|
48
41
|
expiresIn?: string;
|
|
@@ -50,3 +43,32 @@ export interface SmsOtpResult {
|
|
|
50
43
|
[key: string]: any;
|
|
51
44
|
};
|
|
52
45
|
}
|
|
46
|
+
|
|
47
|
+
interface BaseOtpResponse {
|
|
48
|
+
success?: boolean;
|
|
49
|
+
requestId?: string;
|
|
50
|
+
expiresIn?: number;
|
|
51
|
+
resendAfter?: number;
|
|
52
|
+
error?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface SendOtpResponse extends BaseOtpResponse {}
|
|
56
|
+
|
|
57
|
+
export interface VerifyOtpResponse {
|
|
58
|
+
success?: boolean;
|
|
59
|
+
verified?: boolean;
|
|
60
|
+
verifiedAt?: string;
|
|
61
|
+
attemptsRemaining?: number;
|
|
62
|
+
error?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ResendOtpResponse extends BaseOtpResponse {
|
|
66
|
+
attemptsRemaining?: number;
|
|
67
|
+
statusCode?: number;
|
|
68
|
+
errorCode?: string;
|
|
69
|
+
message?: string;
|
|
70
|
+
retryAfter?: number;
|
|
71
|
+
retryAt?: string;
|
|
72
|
+
cooldownSeconds?: number;
|
|
73
|
+
elapsedSeconds?: number;
|
|
74
|
+
}
|
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,
|