@finos_sdk/sdk-ekyc 0.0.14
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/README.md +79 -0
- package/dist/App.d.ts +9 -0
- package/dist/App.js +84 -0
- package/dist/EKYCModule.d.ts +28 -0
- package/dist/EKYCModule.js +101 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11 -0
- package/dist/src/services/sharingService.d.ts +4 -0
- package/dist/src/services/sharingService.js +20 -0
- package/dist/src/types/SDKTransactionType.d.ts +0 -0
- package/dist/src/types/SDKTransactionType.js +1 -0
- package/dist/src/types/ekycC06Type.d.ts +17 -0
- package/dist/src/types/ekycC06Type.js +2 -0
- package/dist/src/types/ekycFaceType.d.ts +20 -0
- package/dist/src/types/ekycFaceType.js +2 -0
- package/dist/src/types/ekycLivenessType.d.ts +59 -0
- package/dist/src/types/ekycLivenessType.js +2 -0
- package/dist/src/types/ekycNFCType.d.ts +44 -0
- package/dist/src/types/ekycNFCType.js +2 -0
- package/dist/src/types/ekycOCRType.d.ts +83 -0
- package/dist/src/types/ekycOCRType.js +2 -0
- package/dist/src/types/ekycTransactionType.d.ts +18 -0
- package/dist/src/types/ekycTransactionType.js +2 -0
- package/dist/src/types/ekycType.d.ts +22 -0
- package/dist/src/types/ekycType.js +2 -0
- package/dist/src/utils/utils.d.ts +2 -0
- package/dist/src/utils/utils.js +45 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
|
|
2
|
+
|
|
3
|
+
# Getting Started
|
|
4
|
+
|
|
5
|
+
>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
|
|
6
|
+
|
|
7
|
+
## Step 1: Start the Metro Server
|
|
8
|
+
|
|
9
|
+
First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
|
|
10
|
+
|
|
11
|
+
To start Metro, run the following command from the _root_ of your React Native project:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# using npm
|
|
15
|
+
npm start
|
|
16
|
+
|
|
17
|
+
# OR using Yarn
|
|
18
|
+
yarn start
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Step 2: Start your Application
|
|
22
|
+
|
|
23
|
+
Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
|
|
24
|
+
|
|
25
|
+
### For Android
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# using npm
|
|
29
|
+
npm run android
|
|
30
|
+
|
|
31
|
+
# OR using Yarn
|
|
32
|
+
yarn android
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### For iOS
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# using npm
|
|
39
|
+
npm run ios
|
|
40
|
+
|
|
41
|
+
# OR using Yarn
|
|
42
|
+
yarn ios
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
|
|
46
|
+
|
|
47
|
+
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
|
|
48
|
+
|
|
49
|
+
## Step 3: Modifying your App
|
|
50
|
+
|
|
51
|
+
Now that you have successfully run the app, let's modify it.
|
|
52
|
+
|
|
53
|
+
1. Open `App.tsx` in your text editor of choice and edit some lines.
|
|
54
|
+
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
|
|
55
|
+
|
|
56
|
+
For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
|
|
57
|
+
|
|
58
|
+
## Congratulations! :tada:
|
|
59
|
+
|
|
60
|
+
You've successfully run and modified your React Native App. :partying_face:
|
|
61
|
+
|
|
62
|
+
### Now what?
|
|
63
|
+
|
|
64
|
+
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
|
|
65
|
+
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
|
|
66
|
+
|
|
67
|
+
# Troubleshooting
|
|
68
|
+
|
|
69
|
+
If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
|
|
70
|
+
|
|
71
|
+
# Learn More
|
|
72
|
+
|
|
73
|
+
To learn more about React Native, take a look at the following resources:
|
|
74
|
+
|
|
75
|
+
- [React Native Website](https://reactnative.dev) - learn more about React Native.
|
|
76
|
+
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
|
|
77
|
+
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
|
|
78
|
+
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
|
|
79
|
+
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
|
package/dist/App.d.ts
ADDED
package/dist/App.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Sample React Native App
|
|
4
|
+
* https://github.com/facebook/react-native
|
|
5
|
+
*
|
|
6
|
+
* @format
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const react_1 = __importDefault(require("react"));
|
|
13
|
+
const react_native_1 = require("react-native");
|
|
14
|
+
const NewAppScreen_1 = require("react-native/Libraries/NewAppScreen");
|
|
15
|
+
function Section({ children, title }) {
|
|
16
|
+
const isDarkMode = (0, react_native_1.useColorScheme)() === 'dark';
|
|
17
|
+
return (<react_native_1.View style={styles.sectionContainer}>
|
|
18
|
+
<react_native_1.Text style={[
|
|
19
|
+
styles.sectionTitle,
|
|
20
|
+
{
|
|
21
|
+
color: isDarkMode ? NewAppScreen_1.Colors.white : NewAppScreen_1.Colors.black,
|
|
22
|
+
},
|
|
23
|
+
]}>
|
|
24
|
+
{title}
|
|
25
|
+
</react_native_1.Text>
|
|
26
|
+
<react_native_1.Text style={[
|
|
27
|
+
styles.sectionDescription,
|
|
28
|
+
{
|
|
29
|
+
color: isDarkMode ? NewAppScreen_1.Colors.light : NewAppScreen_1.Colors.dark,
|
|
30
|
+
},
|
|
31
|
+
]}>
|
|
32
|
+
{children}
|
|
33
|
+
</react_native_1.Text>
|
|
34
|
+
</react_native_1.View>);
|
|
35
|
+
}
|
|
36
|
+
function App() {
|
|
37
|
+
const isDarkMode = (0, react_native_1.useColorScheme)() === 'dark';
|
|
38
|
+
const backgroundStyle = {
|
|
39
|
+
backgroundColor: isDarkMode ? NewAppScreen_1.Colors.darker : NewAppScreen_1.Colors.lighter,
|
|
40
|
+
};
|
|
41
|
+
return (<react_native_1.SafeAreaView style={backgroundStyle}>
|
|
42
|
+
<react_native_1.StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} backgroundColor={backgroundStyle.backgroundColor}/>
|
|
43
|
+
<react_native_1.ScrollView contentInsetAdjustmentBehavior="automatic" style={backgroundStyle}>
|
|
44
|
+
<NewAppScreen_1.Header />
|
|
45
|
+
<react_native_1.View style={{
|
|
46
|
+
backgroundColor: isDarkMode ? NewAppScreen_1.Colors.black : NewAppScreen_1.Colors.white,
|
|
47
|
+
}}>
|
|
48
|
+
<Section title="Step One">
|
|
49
|
+
Edit <react_native_1.Text style={styles.highlight}>App.tsx</react_native_1.Text> to change this
|
|
50
|
+
screen and then come back to see your edits.
|
|
51
|
+
</Section>
|
|
52
|
+
<Section title="See Your Changes">
|
|
53
|
+
<NewAppScreen_1.ReloadInstructions />
|
|
54
|
+
</Section>
|
|
55
|
+
<Section title="Debug">
|
|
56
|
+
<NewAppScreen_1.DebugInstructions />
|
|
57
|
+
</Section>
|
|
58
|
+
<Section title="Learn More">
|
|
59
|
+
Read the docs to discover what to do next:
|
|
60
|
+
</Section>
|
|
61
|
+
<NewAppScreen_1.LearnMoreLinks />
|
|
62
|
+
</react_native_1.View>
|
|
63
|
+
</react_native_1.ScrollView>
|
|
64
|
+
</react_native_1.SafeAreaView>);
|
|
65
|
+
}
|
|
66
|
+
const styles = react_native_1.StyleSheet.create({
|
|
67
|
+
sectionContainer: {
|
|
68
|
+
marginTop: 32,
|
|
69
|
+
paddingHorizontal: 24,
|
|
70
|
+
},
|
|
71
|
+
sectionTitle: {
|
|
72
|
+
fontSize: 24,
|
|
73
|
+
fontWeight: '600',
|
|
74
|
+
},
|
|
75
|
+
sectionDescription: {
|
|
76
|
+
marginTop: 8,
|
|
77
|
+
fontSize: 18,
|
|
78
|
+
fontWeight: '400',
|
|
79
|
+
},
|
|
80
|
+
highlight: {
|
|
81
|
+
fontWeight: '700',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
exports.default = App;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EmitterSubscription } from 'react-native';
|
|
2
|
+
import { NfcConfig, NfcError } from './src/types/ekycNFCType';
|
|
3
|
+
import { SDKEkycResultWithEvent, SDKEkycResultStringWithEvent } from './src/types/ekycType';
|
|
4
|
+
import { C06Config } from './src/types/ekycC06Type';
|
|
5
|
+
import { OcrConfig } from './src/types/ekycOCRType';
|
|
6
|
+
import { LivenessConfig } from './src/types/ekycLivenessType';
|
|
7
|
+
import { FaceServiceConfig } from './src/types/ekycFaceType';
|
|
8
|
+
declare class SDKeKYC {
|
|
9
|
+
private eventEmitter;
|
|
10
|
+
private listeners;
|
|
11
|
+
constructor();
|
|
12
|
+
startOcr(config: OcrConfig): Promise<SDKEkycResultStringWithEvent>;
|
|
13
|
+
startNfcScan(config: NfcConfig): Promise<SDKEkycResultStringWithEvent>;
|
|
14
|
+
checkC06(config: C06Config): Promise<SDKEkycResultStringWithEvent>;
|
|
15
|
+
startLiveness(config: LivenessConfig): Promise<SDKEkycResultStringWithEvent>;
|
|
16
|
+
startFaceCompare(config: FaceServiceConfig): Promise<SDKEkycResultStringWithEvent>;
|
|
17
|
+
onResume(): void;
|
|
18
|
+
onPause(): void;
|
|
19
|
+
onNfcScanStart(callback: (data: SDKEkycResultWithEvent) => void): EmitterSubscription | null;
|
|
20
|
+
onNfcScanSuccess(callback: (data: SDKEkycResultStringWithEvent) => void): EmitterSubscription | null;
|
|
21
|
+
onNfcError(callback: (error: NfcError) => void): EmitterSubscription | null;
|
|
22
|
+
onC06Success(callback: (data: SDKEkycResultWithEvent) => void): EmitterSubscription | null;
|
|
23
|
+
onC06Error(callback: (error: NfcError) => void): EmitterSubscription | null;
|
|
24
|
+
removeAllListeners(): void;
|
|
25
|
+
}
|
|
26
|
+
declare const sdkEKYC: SDKeKYC;
|
|
27
|
+
export { SDKeKYC };
|
|
28
|
+
export default sdkEKYC;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SDKeKYC = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const EKYCNativeModule = react_native_1.NativeModules.EKYCModule;
|
|
6
|
+
// Validate that the module is available
|
|
7
|
+
if (!EKYCNativeModule) {
|
|
8
|
+
throw new Error('EKYCModule is not available. Make sure you have:\n' +
|
|
9
|
+
'1. Called SdkEkyc.initSDKEkyc() in native code\n' +
|
|
10
|
+
'2. Properly registered EKYCModule in MainApplication.kt\n' +
|
|
11
|
+
'3. Rebuilt your app completely\n' +
|
|
12
|
+
'4. If the error persists, try cleaning build folders:\n' +
|
|
13
|
+
' - rm -rf android/app/build\n' +
|
|
14
|
+
' - cd android && ./gradlew clean');
|
|
15
|
+
}
|
|
16
|
+
// Initialize the module
|
|
17
|
+
try {
|
|
18
|
+
EKYCNativeModule.initSdkEkyc().catch(e => {
|
|
19
|
+
console.warn('Failed to initialize SDK EKYC:', e);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
console.warn('Failed to initialize SDK EKYC:', e);
|
|
24
|
+
}
|
|
25
|
+
class SDKeKYC {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.listeners = [];
|
|
28
|
+
this.eventEmitter = new react_native_1.NativeEventEmitter(EKYCNativeModule);
|
|
29
|
+
}
|
|
30
|
+
async startOcr(config) {
|
|
31
|
+
var _a;
|
|
32
|
+
return EKYCNativeModule.startOcr(config.appKey, config.idImagePath, config.expectedDocumentSide, (_a = config.transactionId) !== null && _a !== void 0 ? _a : '');
|
|
33
|
+
}
|
|
34
|
+
// Start NFC scanning
|
|
35
|
+
async startNfcScan(config) {
|
|
36
|
+
return EKYCNativeModule.startNfcScan(config.appKey, config.documentNumber, config.birthDate, config.expireDate, config.transactionId, config.facePathStorage);
|
|
37
|
+
}
|
|
38
|
+
// Check C06 residence verification
|
|
39
|
+
async checkC06(config) {
|
|
40
|
+
return EKYCNativeModule.checkC06(config.appKey, config.sod, config.idCardNumber, config.recentLocation, config.deviceType);
|
|
41
|
+
}
|
|
42
|
+
async startLiveness(config) {
|
|
43
|
+
var _a;
|
|
44
|
+
return EKYCNativeModule.startLiveness(config.appKey, config.selfieImage, config.usingRandomAction, (_a = config.transactionId) !== null && _a !== void 0 ? _a : '', config.isStraight);
|
|
45
|
+
}
|
|
46
|
+
async startFaceCompare(config) {
|
|
47
|
+
var _a;
|
|
48
|
+
return EKYCNativeModule.startFaceCompare(config.appKey, (_a = config.transactionId) !== null && _a !== void 0 ? _a : '', config.selfieImage, config.idImage);
|
|
49
|
+
}
|
|
50
|
+
// Lifecycle methods
|
|
51
|
+
onResume() {
|
|
52
|
+
EKYCNativeModule.onResume();
|
|
53
|
+
}
|
|
54
|
+
onPause() {
|
|
55
|
+
EKYCNativeModule.onPause();
|
|
56
|
+
}
|
|
57
|
+
// Event listeners
|
|
58
|
+
onNfcScanStart(callback) {
|
|
59
|
+
if (!this.eventEmitter)
|
|
60
|
+
return null;
|
|
61
|
+
const listener = this.eventEmitter.addListener('onNfcScanStart', callback);
|
|
62
|
+
this.listeners.push(listener);
|
|
63
|
+
return listener;
|
|
64
|
+
}
|
|
65
|
+
onNfcScanSuccess(callback) {
|
|
66
|
+
if (!this.eventEmitter)
|
|
67
|
+
return null;
|
|
68
|
+
const listener = this.eventEmitter.addListener('onNfcScanSuccess', callback);
|
|
69
|
+
this.listeners.push(listener);
|
|
70
|
+
return listener;
|
|
71
|
+
}
|
|
72
|
+
onNfcError(callback) {
|
|
73
|
+
if (!this.eventEmitter)
|
|
74
|
+
return null;
|
|
75
|
+
const listener = this.eventEmitter.addListener('onNfcError', callback);
|
|
76
|
+
this.listeners.push(listener);
|
|
77
|
+
return listener;
|
|
78
|
+
}
|
|
79
|
+
onC06Success(callback) {
|
|
80
|
+
if (!this.eventEmitter)
|
|
81
|
+
return null;
|
|
82
|
+
const listener = this.eventEmitter.addListener('onC06Success', callback);
|
|
83
|
+
this.listeners.push(listener);
|
|
84
|
+
return listener;
|
|
85
|
+
}
|
|
86
|
+
onC06Error(callback) {
|
|
87
|
+
if (!this.eventEmitter)
|
|
88
|
+
return null;
|
|
89
|
+
const listener = this.eventEmitter.addListener('onC06Error', callback);
|
|
90
|
+
this.listeners.push(listener);
|
|
91
|
+
return listener;
|
|
92
|
+
}
|
|
93
|
+
removeAllListeners() {
|
|
94
|
+
this.listeners.forEach(listener => listener.remove());
|
|
95
|
+
this.listeners = [];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.SDKeKYC = SDKeKYC;
|
|
99
|
+
// Create a singleton instance
|
|
100
|
+
const sdkEKYC = new SDKeKYC();
|
|
101
|
+
exports.default = sdkEKYC;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseNfcResponse = exports.SDKeKYC = exports.sdkEKYC = void 0;
|
|
7
|
+
var EKYCModule_1 = require("./EKYCModule");
|
|
8
|
+
Object.defineProperty(exports, "sdkEKYC", { enumerable: true, get: function () { return __importDefault(EKYCModule_1).default; } });
|
|
9
|
+
Object.defineProperty(exports, "SDKeKYC", { enumerable: true, get: function () { return EKYCModule_1.SDKeKYC; } });
|
|
10
|
+
var utils_1 = require("./src/utils/utils");
|
|
11
|
+
Object.defineProperty(exports, "parseNfcResponse", { enumerable: true, get: function () { return utils_1.parseNfcResponse; } });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SharingService = void 0;
|
|
10
|
+
require("reflect-metadata");
|
|
11
|
+
const tsyringe_1 = require("tsyringe");
|
|
12
|
+
let SharingService = class SharingService {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.imageNFC = null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
SharingService = __decorate([
|
|
18
|
+
(0, tsyringe_1.singleton)()
|
|
19
|
+
], SharingService);
|
|
20
|
+
exports.SharingService = SharingService;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface CheckC06Response {
|
|
2
|
+
resCode?: String;
|
|
3
|
+
resData?: C06CheckResult;
|
|
4
|
+
resMessage?: String;
|
|
5
|
+
}
|
|
6
|
+
export interface C06CheckResult {
|
|
7
|
+
rarResponseId?: string;
|
|
8
|
+
signature?: string;
|
|
9
|
+
verifyStatus?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface C06Config {
|
|
12
|
+
appKey: string;
|
|
13
|
+
sod: string;
|
|
14
|
+
idCardNumber: string;
|
|
15
|
+
recentLocation: string;
|
|
16
|
+
deviceType?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface CheckFaceResponse {
|
|
2
|
+
requestId?: string;
|
|
3
|
+
result?: FaceVerifyResult;
|
|
4
|
+
status?: string;
|
|
5
|
+
statusCode?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface FaceVerifyResult {
|
|
10
|
+
conf?: number;
|
|
11
|
+
match?: string;
|
|
12
|
+
matchScore?: number;
|
|
13
|
+
toBeReviewed?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface FaceServiceConfig {
|
|
16
|
+
appKey: string;
|
|
17
|
+
transactionId?: string;
|
|
18
|
+
selfieImage: string;
|
|
19
|
+
idImage: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CheckSummaryResponse } from "./ekycOCRType";
|
|
2
|
+
export interface LivenessConfig {
|
|
3
|
+
appKey: string;
|
|
4
|
+
transactionId?: string;
|
|
5
|
+
usingRandomAction: boolean;
|
|
6
|
+
isStraight: boolean;
|
|
7
|
+
selfieImage: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CheckLivenessResponse {
|
|
10
|
+
metadata?: Metadata;
|
|
11
|
+
result?: LivenessCheckResult;
|
|
12
|
+
status?: string;
|
|
13
|
+
statusCode?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Metadata {
|
|
16
|
+
requestId?: string;
|
|
17
|
+
transactionId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface LivenessCheckResult {
|
|
20
|
+
details?: Details;
|
|
21
|
+
summary?: CheckSummaryResponse;
|
|
22
|
+
}
|
|
23
|
+
export interface Details {
|
|
24
|
+
ageRange?: AgeRange;
|
|
25
|
+
liveFace?: LiveFace;
|
|
26
|
+
qualityChecks?: QualityChecks;
|
|
27
|
+
}
|
|
28
|
+
export interface AgeRange {
|
|
29
|
+
confidence?: string;
|
|
30
|
+
high?: number;
|
|
31
|
+
low?: number;
|
|
32
|
+
score?: number;
|
|
33
|
+
value?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface LiveFace {
|
|
36
|
+
confidence?: string;
|
|
37
|
+
score?: number;
|
|
38
|
+
value?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface QualityChecks {
|
|
41
|
+
blur?: QualityCheck;
|
|
42
|
+
bright?: QualityCheck;
|
|
43
|
+
dull?: QualityCheck;
|
|
44
|
+
eyesClosed?: QualityCheck;
|
|
45
|
+
eyewear?: QualityCheck;
|
|
46
|
+
faceOccluded?: QualityCheck;
|
|
47
|
+
hat?: QualityCheck;
|
|
48
|
+
headTurned?: QualityCheck;
|
|
49
|
+
maskPresent?: QualityCheck;
|
|
50
|
+
multipleFaces?: QualityCheck;
|
|
51
|
+
nudity?: QualityCheck;
|
|
52
|
+
readingGlasses?: QualityCheck;
|
|
53
|
+
sunglasses?: QualityCheck;
|
|
54
|
+
}
|
|
55
|
+
export interface QualityCheck {
|
|
56
|
+
confidence?: string;
|
|
57
|
+
score?: number;
|
|
58
|
+
value?: string;
|
|
59
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface NfcConfig {
|
|
2
|
+
appKey: string;
|
|
3
|
+
documentNumber: string;
|
|
4
|
+
birthDate: string;
|
|
5
|
+
expireDate: string;
|
|
6
|
+
transactionId?: string;
|
|
7
|
+
facePathStorage?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface NFCData {
|
|
10
|
+
signature?: string;
|
|
11
|
+
certificate?: string;
|
|
12
|
+
sod?: string;
|
|
13
|
+
mrz?: string;
|
|
14
|
+
faceImage?: string;
|
|
15
|
+
cardNumber?: string;
|
|
16
|
+
dateOfBirth?: string;
|
|
17
|
+
issueDate?: string;
|
|
18
|
+
previousNumber?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
sex?: string;
|
|
21
|
+
nationality?: string;
|
|
22
|
+
nation?: string;
|
|
23
|
+
religion?: string;
|
|
24
|
+
hometown?: string;
|
|
25
|
+
address?: string;
|
|
26
|
+
character?: string;
|
|
27
|
+
expiredDate?: string;
|
|
28
|
+
fatherName?: string;
|
|
29
|
+
motherName?: string;
|
|
30
|
+
partnerName?: string;
|
|
31
|
+
nfcInfo: NfcInfo;
|
|
32
|
+
}
|
|
33
|
+
export interface NfcInfo {
|
|
34
|
+
dg1?: string;
|
|
35
|
+
dg2?: string;
|
|
36
|
+
dg13?: string;
|
|
37
|
+
dg14?: string;
|
|
38
|
+
dg15?: string;
|
|
39
|
+
sod?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface NfcError {
|
|
42
|
+
event: string;
|
|
43
|
+
message: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export interface OcrConfig {
|
|
2
|
+
appKey: string;
|
|
3
|
+
transactionId: string;
|
|
4
|
+
idImagePath: string;
|
|
5
|
+
expectedDocumentSide: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CheckOcrResponse {
|
|
8
|
+
requestId?: string;
|
|
9
|
+
result?: OcrCheckResult;
|
|
10
|
+
status?: string;
|
|
11
|
+
statusCode?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface OcrCheckResult {
|
|
14
|
+
details?: Detail[];
|
|
15
|
+
summary?: CheckSummaryResponse;
|
|
16
|
+
}
|
|
17
|
+
export interface CheckSummaryResponse {
|
|
18
|
+
action?: string;
|
|
19
|
+
details?: Details[];
|
|
20
|
+
}
|
|
21
|
+
export interface Detail {
|
|
22
|
+
fieldsExtracted?: FieldsExtracted;
|
|
23
|
+
forgeryChecks?: ForgeryChecks;
|
|
24
|
+
qualityChecks?: QualityChecks;
|
|
25
|
+
ruleChecks?: RuleChecks;
|
|
26
|
+
type?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface Details {
|
|
29
|
+
code?: string;
|
|
30
|
+
message?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface FieldsExtracted {
|
|
33
|
+
dob?: ExtractedField;
|
|
34
|
+
doe?: ExtractedField;
|
|
35
|
+
doi?: ExtractedField;
|
|
36
|
+
gender?: ExtractedField;
|
|
37
|
+
homeTown?: ExtractedField;
|
|
38
|
+
idNumber?: ExtractedField;
|
|
39
|
+
mrzString?: MrzStringField;
|
|
40
|
+
name?: ExtractedField;
|
|
41
|
+
nationality?: ExtractedField;
|
|
42
|
+
permanentAddress?: PermanentAddressField;
|
|
43
|
+
placeOfIssue?: ExtractedField;
|
|
44
|
+
}
|
|
45
|
+
export interface ExtractedField {
|
|
46
|
+
confidence?: string;
|
|
47
|
+
score?: number;
|
|
48
|
+
toBeReviewed?: string;
|
|
49
|
+
value?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface MrzStringField extends ExtractedField {
|
|
52
|
+
dateOfBirth?: string;
|
|
53
|
+
dateOfExpiry?: string;
|
|
54
|
+
fullName?: string;
|
|
55
|
+
gender?: string;
|
|
56
|
+
idNumber?: string;
|
|
57
|
+
nationality?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface PermanentAddressField extends ExtractedField {
|
|
60
|
+
district?: string;
|
|
61
|
+
province?: string;
|
|
62
|
+
street?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ForgeryChecks {
|
|
65
|
+
colorPrintout?: CheckField;
|
|
66
|
+
digitalText?: CheckField;
|
|
67
|
+
facePhoto?: CheckField;
|
|
68
|
+
physicalText?: CheckField;
|
|
69
|
+
}
|
|
70
|
+
export interface QualityChecks {
|
|
71
|
+
blackAndWhite?: CheckField;
|
|
72
|
+
blur?: CheckField;
|
|
73
|
+
capturedFromScreen?: CheckField;
|
|
74
|
+
glare?: CheckField;
|
|
75
|
+
}
|
|
76
|
+
export interface CheckField {
|
|
77
|
+
confidence?: string;
|
|
78
|
+
score?: number;
|
|
79
|
+
toBeReviewed?: string;
|
|
80
|
+
value?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface RuleChecks {
|
|
83
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface SDKTransactionResponse {
|
|
2
|
+
id?: string;
|
|
3
|
+
apiCode?: string;
|
|
4
|
+
apiId?: string;
|
|
5
|
+
applicationId?: string;
|
|
6
|
+
customerId?: string;
|
|
7
|
+
externalId?: string;
|
|
8
|
+
imagePath1?: string;
|
|
9
|
+
imagePath2?: string;
|
|
10
|
+
planId?: string;
|
|
11
|
+
providerCode?: string;
|
|
12
|
+
requestTime?: string;
|
|
13
|
+
statusCode?: string;
|
|
14
|
+
transactionId?: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
customTempData?: any;
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CheckC06Response } from "./ekycC06Type";
|
|
2
|
+
import { CheckFaceResponse } from "./ekycFaceType";
|
|
3
|
+
import { CheckLivenessResponse } from "./ekycLivenessType";
|
|
4
|
+
import { CheckOcrResponse } from "./ekycOCRType";
|
|
5
|
+
import { SDKTransactionResponse } from "./ekycTransactionType";
|
|
6
|
+
export interface SDKEkycResult {
|
|
7
|
+
isSdkCheckKey: boolean;
|
|
8
|
+
nfcResponse?: string;
|
|
9
|
+
checkC06Response?: CheckC06Response;
|
|
10
|
+
checkFaceResponse?: CheckFaceResponse;
|
|
11
|
+
ocrResponse?: CheckOcrResponse;
|
|
12
|
+
checkLivenessResponse?: CheckLivenessResponse;
|
|
13
|
+
transactionResponse?: SDKTransactionResponse;
|
|
14
|
+
}
|
|
15
|
+
export interface SDKEkycResultWithEvent {
|
|
16
|
+
data?: SDKEkycResult;
|
|
17
|
+
event?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SDKEkycResultStringWithEvent {
|
|
20
|
+
data: string;
|
|
21
|
+
event: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseNfcResponse = void 0;
|
|
4
|
+
// Utility function to parse NFC response string to NFCData
|
|
5
|
+
function parseNfcResponse(nfcResponseStr) {
|
|
6
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7
|
+
try {
|
|
8
|
+
// Parse JSON string
|
|
9
|
+
const nfcResponse = JSON.parse(nfcResponseStr);
|
|
10
|
+
return {
|
|
11
|
+
address: nfcResponse.address,
|
|
12
|
+
cardNumber: nfcResponse.cardNumber,
|
|
13
|
+
character: nfcResponse.character,
|
|
14
|
+
dateOfBirth: nfcResponse.dateOfBirth,
|
|
15
|
+
expiredDate: nfcResponse.expiredDate,
|
|
16
|
+
faceImage: nfcResponse.faceImage,
|
|
17
|
+
fatherName: nfcResponse.fatherName,
|
|
18
|
+
motherName: nfcResponse.motherName,
|
|
19
|
+
hometown: nfcResponse.hometown,
|
|
20
|
+
issueDate: nfcResponse.issueDate,
|
|
21
|
+
mrz: nfcResponse.mrz,
|
|
22
|
+
name: nfcResponse.name,
|
|
23
|
+
nation: nfcResponse.nation,
|
|
24
|
+
nationality: nfcResponse.nationality,
|
|
25
|
+
partnerName: nfcResponse.partnerName,
|
|
26
|
+
previousNumber: nfcResponse.previousNumber,
|
|
27
|
+
religion: nfcResponse.religion,
|
|
28
|
+
sex: nfcResponse.sex,
|
|
29
|
+
nfcInfo: {
|
|
30
|
+
dg1: (_a = nfcResponse.nfcInfo) === null || _a === void 0 ? void 0 : _a.dg1,
|
|
31
|
+
dg2: (_b = nfcResponse.nfcInfo) === null || _b === void 0 ? void 0 : _b.dg2,
|
|
32
|
+
dg13: (_c = nfcResponse.nfcInfo) === null || _c === void 0 ? void 0 : _c.dg13,
|
|
33
|
+
dg14: (_d = nfcResponse.nfcInfo) === null || _d === void 0 ? void 0 : _d.dg14,
|
|
34
|
+
dg15: (_e = nfcResponse.nfcInfo) === null || _e === void 0 ? void 0 : _e.dg15,
|
|
35
|
+
sod: (_f = nfcResponse.nfcInfo) === null || _f === void 0 ? void 0 : _f.sod
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.error('Error parsing NFC response:', error);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.parseNfcResponse = parseNfcResponse;
|
|
45
|
+
;
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@finos_sdk/sdk-ekyc",
|
|
3
|
+
"version": "0.0.14",
|
|
4
|
+
"description": "SDK React Native EKYC",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/finos/sdk-ekyc.git"
|
|
13
|
+
},
|
|
14
|
+
"author": "FinOS",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/finos/sdk-ekyc/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/finos/sdk-ekyc#readme",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"react-native",
|
|
22
|
+
"ekyc",
|
|
23
|
+
"sdk"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"android": "npm run-android",
|
|
27
|
+
"ios": "react-native run-ios",
|
|
28
|
+
"start": "react-native start --reset-cache",
|
|
29
|
+
"clean": "cd android && ./gradlew clean && cd ..",
|
|
30
|
+
"npm-install": "npm install",
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"prepare": "npm run build",
|
|
33
|
+
"pulish-sdk": "npm run build && npm version patch --force && npm publish --access public"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"react": "18.3.1",
|
|
37
|
+
"react-native": "0.76.9",
|
|
38
|
+
"tsyringe": "^4.10.0",
|
|
39
|
+
"reflect-metadata": "^0.2.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@babel/core": "^7.25.2",
|
|
43
|
+
"@babel/preset-env": "^7.25.3",
|
|
44
|
+
"@babel/runtime": "^7.25.0",
|
|
45
|
+
"@react-native-community/cli": "15.0.1",
|
|
46
|
+
"@react-native-community/cli-platform-android": "15.0.1",
|
|
47
|
+
"@react-native-community/cli-platform-ios": "15.0.1",
|
|
48
|
+
"@react-native/babel-preset": "0.76.9",
|
|
49
|
+
"@react-native/eslint-config": "0.76.9",
|
|
50
|
+
"@react-native/metro-config": "0.76.9",
|
|
51
|
+
"@react-native/typescript-config": "0.76.9",
|
|
52
|
+
"@types/react": "^18.2.6",
|
|
53
|
+
"@types/react-test-renderer": "^18.0.0",
|
|
54
|
+
"babel-jest": "^29.6.3",
|
|
55
|
+
"eslint": "^8.19.0",
|
|
56
|
+
"jest": "^29.6.3",
|
|
57
|
+
"prettier": "2.8.8",
|
|
58
|
+
"react-test-renderer": "18.3.1",
|
|
59
|
+
"typescript": "5.0.4"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=18"
|
|
63
|
+
}
|
|
64
|
+
}
|