@finos_sdk/sdk-ekyc 1.5.2 → 1.5.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 +25 -24
- package/dist/EKYCModule.d.ts +7 -7
- package/dist/dist/package.json +86 -0
- package/dist/package.json +1 -1
- package/dist/src/modules/FinosEKYCModule.d.ts +7 -7
- package/dist/src/modules/FinosESignModule.d.ts +8 -8
- package/dist/src/types/ekycSmsOtpType.d.ts +28 -7
- package/ios/.xcode.env.local +2 -0
- package/package.json +1 -1
- package/src/modules/FinosEKYCModule.ts +7 -7
- package/src/modules/FinosESignModule.ts +8 -8
- package/src/types/ekycSmsOtpType.ts +30 -8
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.3"
|
|
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
|
|
@@ -1891,14 +1913,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
1891
1913
|
callbackSuccess = { event, result ->
|
|
1892
1914
|
Log.d(TAG, "✅ sendOtp() success")
|
|
1893
1915
|
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
|
-
}
|
|
1916
|
+
map.putCustomData(result?.customData)
|
|
1902
1917
|
}
|
|
1903
1918
|
sendEvent("onSmsOtpSendSuccess", eventMap)
|
|
1904
1919
|
promise.resolve(promiseMap)
|
|
@@ -1952,14 +1967,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
1952
1967
|
callbackSuccess = { event, result ->
|
|
1953
1968
|
Log.d(TAG, "✅ verifyOtp() success")
|
|
1954
1969
|
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
|
-
}
|
|
1970
|
+
map.putCustomData(result?.customData)
|
|
1963
1971
|
}
|
|
1964
1972
|
sendEvent("onSmsOtpVerifySuccess", eventMap)
|
|
1965
1973
|
promise.resolve(promiseMap)
|
|
@@ -2011,14 +2019,7 @@ class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMo
|
|
|
2011
2019
|
callbackSuccess = { event, result ->
|
|
2012
2020
|
Log.d(TAG, "✅ resendOtp() success")
|
|
2013
2021
|
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
|
-
}
|
|
2022
|
+
map.putCustomData(result?.customData)
|
|
2022
2023
|
}
|
|
2023
2024
|
sendEvent("onSmsOtpResendSuccess", eventMap)
|
|
2024
2025
|
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;
|
|
@@ -48,12 +48,12 @@ declare class SDKeKYC {
|
|
|
48
48
|
onEkycUISuccess(callback: (data: any) => void): EmitterSubscription | null;
|
|
49
49
|
onEkycUIError(callback: (error: any) => void): EmitterSubscription | null;
|
|
50
50
|
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:
|
|
51
|
+
sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse>;
|
|
52
|
+
verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse>;
|
|
53
|
+
resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse>;
|
|
54
|
+
onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void): EmitterSubscription | null;
|
|
55
|
+
onSmsOtpVerifySuccess(callback: (data: VerifyOtpResponse) => void): EmitterSubscription | null;
|
|
56
|
+
onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void): EmitterSubscription | null;
|
|
57
57
|
onSmsOtpError(callback: (error: SmsOtpError) => void): EmitterSubscription | null;
|
|
58
58
|
initializeESign(finosToken?: string | null, isProd?: boolean): Promise<ESignInitResult>;
|
|
59
59
|
getSdkToken(identity: string, name: string, deviceId: string): Promise<string>;
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
}
|
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.3",
|
|
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",
|
|
@@ -5,7 +5,7 @@ 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';
|
|
@@ -164,20 +164,20 @@ export declare class FinosEKYCModule {
|
|
|
164
164
|
* Send SMS OTP
|
|
165
165
|
* @param config SMS OTP configuration
|
|
166
166
|
*/
|
|
167
|
-
sendOtp(config: SmsOtpConfig): Promise<
|
|
167
|
+
sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse>;
|
|
168
168
|
/**
|
|
169
169
|
* Verify SMS OTP
|
|
170
170
|
* @param config SMS OTP configuration (must include requestId)
|
|
171
171
|
* @param otpCode OTP code from SMS
|
|
172
172
|
*/
|
|
173
|
-
verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<
|
|
173
|
+
verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse>;
|
|
174
174
|
/**
|
|
175
175
|
* Resend SMS OTP
|
|
176
176
|
* @param config SMS OTP configuration (must include requestId)
|
|
177
177
|
*/
|
|
178
|
-
resendOtp(config: SmsOtpConfig): Promise<
|
|
179
|
-
onSmsOtpSendSuccess(callback: (data:
|
|
180
|
-
onSmsOtpResendSuccess(callback: (data:
|
|
178
|
+
resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse>;
|
|
179
|
+
onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void): import("react-native").EmitterSubscription | null;
|
|
180
|
+
onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void): import("react-native").EmitterSubscription | null;
|
|
181
181
|
/** Payload là EKYCError: { event, code, message }. */
|
|
182
182
|
onSmsOtpError(callback: (error: EKYCError) => void): import("react-native").EmitterSubscription | null;
|
|
183
183
|
/**
|
|
@@ -375,7 +375,7 @@ export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
|
375
375
|
export type { FaceServiceConfig, FaceCompareError } from '../types/ekycFaceType';
|
|
376
376
|
export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError } from '../types/ekycType';
|
|
377
377
|
export { getEkycError, AppIDType } from '../types/ekycType';
|
|
378
|
-
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
378
|
+
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
379
379
|
export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
|
|
380
380
|
export { SDK_VERSION, SDK_NAME };
|
|
381
381
|
export default FinosEKYC;
|
|
@@ -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';
|
|
@@ -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';
|
|
@@ -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 {};
|
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.3",
|
|
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",
|
|
@@ -7,7 +7,7 @@ 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';
|
|
@@ -404,7 +404,7 @@ export class FinosEKYCModule {
|
|
|
404
404
|
* Send SMS OTP
|
|
405
405
|
* @param config SMS OTP configuration
|
|
406
406
|
*/
|
|
407
|
-
public async sendOtp(config: SmsOtpConfig): Promise<
|
|
407
|
+
public async sendOtp(config: SmsOtpConfig): Promise<SendOtpResponse> {
|
|
408
408
|
this.validateSDKReady();
|
|
409
409
|
|
|
410
410
|
try {
|
|
@@ -423,7 +423,7 @@ export class FinosEKYCModule {
|
|
|
423
423
|
* @param config SMS OTP configuration (must include requestId)
|
|
424
424
|
* @param otpCode OTP code from SMS
|
|
425
425
|
*/
|
|
426
|
-
public async verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<
|
|
426
|
+
public async verifyOtp(config: SmsOtpConfig, otpCode: string): Promise<VerifyOtpResponse> {
|
|
427
427
|
this.validateSDKReady();
|
|
428
428
|
|
|
429
429
|
try {
|
|
@@ -441,7 +441,7 @@ export class FinosEKYCModule {
|
|
|
441
441
|
* Resend SMS OTP
|
|
442
442
|
* @param config SMS OTP configuration (must include requestId)
|
|
443
443
|
*/
|
|
444
|
-
public async resendOtp(config: SmsOtpConfig): Promise<
|
|
444
|
+
public async resendOtp(config: SmsOtpConfig): Promise<ResendOtpResponse> {
|
|
445
445
|
this.validateSDKReady();
|
|
446
446
|
|
|
447
447
|
try {
|
|
@@ -456,7 +456,7 @@ export class FinosEKYCModule {
|
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
// SMS OTP Event Listeners
|
|
459
|
-
public onSmsOtpSendSuccess(callback: (data:
|
|
459
|
+
public onSmsOtpSendSuccess(callback: (data: SendOtpResponse) => void) {
|
|
460
460
|
const listener = this.sdk.onSmsOtpSendSuccess(callback);
|
|
461
461
|
if (!listener) {
|
|
462
462
|
console.warn('⚠️ onSmsOtpSendSuccess: Event emitter not ready. Make sure SDK is initialized.');
|
|
@@ -464,7 +464,7 @@ export class FinosEKYCModule {
|
|
|
464
464
|
return listener;
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
-
public onSmsOtpResendSuccess(callback: (data:
|
|
467
|
+
public onSmsOtpResendSuccess(callback: (data: ResendOtpResponse) => void) {
|
|
468
468
|
const listener = this.sdk.onSmsOtpResendSuccess(callback);
|
|
469
469
|
if (!listener) {
|
|
470
470
|
console.warn('⚠️ onSmsOtpResendSuccess: Event emitter not ready.');
|
|
@@ -1049,7 +1049,7 @@ export { SDKFaceDetectStatus } from '../types/ekycLivenessType';
|
|
|
1049
1049
|
export type { FaceServiceConfig, FaceCompareError } from '../types/ekycFaceType';
|
|
1050
1050
|
export type { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent, EKYCError } from '../types/ekycType';
|
|
1051
1051
|
export { getEkycError, AppIDType } from '../types/ekycType';
|
|
1052
|
-
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError } from '../types/ekycSmsOtpType';
|
|
1052
|
+
export type { SmsOtpConfig, SmsOtpResult, SmsOtpError, SendOtpResponse, VerifyOtpResponse, ResendOtpResponse } from '../types/ekycSmsOtpType';
|
|
1053
1053
|
export type { ESignInitResult, ESignOpenSessionResult, ESignCertificate, ESignSignRequest, ESignError, ESignAuthenticateResult } from '../types/ekycESignType';
|
|
1054
1054
|
|
|
1055
1055
|
// 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';
|
|
@@ -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
|
+
}
|