@soyio/soyio-rn-sdk 2.3.1 → 3.1.0
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 +287 -132
- package/android/build.gradle +56 -0
- package/android/libs/facetec-sdk-9.7.96.aar +0 -0
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/java/com/soyio/soyiorndk/AndroidFacetecSdkModule.kt +224 -0
- package/android/src/main/java/com/soyio/soyiorndk/AndroidFacetecSdkPackage.kt +16 -0
- package/android/src/main/java/com/soyio/soyiorndk/ApiDate.kt +5 -0
- package/android/src/main/java/com/soyio/soyiorndk/BaseFaceTecProcessor.kt +44 -0
- package/android/src/main/java/com/soyio/soyiorndk/FaceTecRequestService.kt +115 -0
- package/android/src/main/java/com/soyio/soyiorndk/FacetecConfig.kt +308 -0
- package/android/src/main/java/com/soyio/soyiorndk/SoyioIdOnlyProcessor.kt +81 -0
- package/android/src/main/java/com/soyio/soyiorndk/SoyioValidationProcessor.kt +134 -0
- package/android/src/main/res/values/strings.xml +134 -0
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/fonts/RobotoFlex.ttf +0 -0
- package/assets/icon.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-close.imageset/Contents.json +23 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-close.imageset/facetec-close@1x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-close.imageset/facetec-close@2x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-close.imageset/facetec-close@3x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-id-front.imageset/Contents.json +23 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-id-front.imageset/facetec-id-front@1x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-id-front.imageset/facetec-id-front@2x.png +0 -0
- package/assets/images/SoyioRnSdk.xcassets/facetec-id-front.imageset/facetec-id-front@3x.png +0 -0
- package/assets/splash.png +0 -0
- package/index.ts +14 -3
- package/ios/ApiDate.swift +5 -0
- package/ios/FacetecConfig.swift +217 -0
- package/ios/FacetecStrings.swift +139 -0
- package/ios/Frameworks/FaceTecSDK.framework/Assets.car +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/FaceTecSDK +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/GenericGuidanceContentLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Headers/FaceTecPublicApi.h +1935 -0
- package/ios/Frameworks/FaceTecSDK.framework/Headers/FaceTecPublicStringKeys.h +109 -0
- package/ios/Frameworks/FaceTecSDK.framework/Headers/FaceTecSDK.h +16 -0
- package/ios/Frameworks/FaceTecSDK.framework/Info.plist +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Modules/module.modulemap +6 -0
- package/ios/Frameworks/FaceTecSDK.framework/PrivacyInfo.xcprivacy +29 -0
- package/ios/Frameworks/FaceTecSDK.framework/ReadyScreenGuidanceContentLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/RetryScreenGuidanceContentLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/SharedGuidanceLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/9Uo-4b-JiE-view-Ae0-rb-UqS.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/CJ6-MX-bJp-view-8JL-Rc-0g1.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/FaceScanViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/FaceTecAdditionalReviewViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/FaceTecIDFeedbackViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/FaceTecOCRConfirmationViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/IDCaptureViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/IDSelectionViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/Info.plist +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/Pyw-6G-JSY-view-Zue-Eo-Q2U.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/QWA-8Y-vUM-view-wJB-Z5-eD2.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/alz-Ia-X3d-view-IKu-EI-Hug.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/Storyboard.storyboardc/l2Q-cc-kD8-view-UUy-6c-meu.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/attributions.txt +462 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/1f5b84f51ce0fcfbb76e904b7bcaa7560f601e1394a0b29367a09385312287eb +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/2b075ac1a6132b5b8a4c9ef0ba6b0cd84db7838aca9a000e50d907f40770a4ab +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/59cc2a9af81aaca2376702c2490650f4da2775fa673274db98aad41b7ef101c0 +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/5b63e98b991aedabb60665503384f30bffd939decf9433883b30b78011ee501a +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/66388dc76dc16bc6b76b682edd218a575bf45b9b +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/6b3133f0f39ff89a2a169d61176ee17cafacc5e288f334e2b64ee82892d11ccd +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/9077d16225f9314163ef1e7db6fc7d4088bb903d134bd95f23d5591ca4dfbfca +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/a74f2afb9d20f2375ccbd14e67c094b85c89ceb608f7cf8ae04f3f646a6c5672 +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/b501893e75f62ee1707643e35b21109927b07ed5b202321c961b424cbc2e4695 +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/dbd7a353f0130bb983d6ba05917e9be991d70e8f028df4b74e30bc6497ef7f71 +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/f2.xml +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/fd6d368a5658496536e2bfae170d1b823a3629b242cafc09784bfba4e56d8c80 +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/marker +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/vu0ilin6we3lrzo5f83f7qs2jul4aq7v4aoynrmch8zfvpi8ezrfyafa4t0fx87l +0 -0
- package/ios/Frameworks/FaceTecSDK.framework/strip-unused-architectures-from-target.sh +62 -0
- package/ios/IOSFacetecSdk.m +22 -0
- package/ios/IOSFacetecSdk.swift +219 -0
- package/ios/ProcessorProtocol.swift +6 -0
- package/ios/SoyioIDOnlyProcessor.swift +168 -0
- package/ios/SoyioPhotoIDMatchProcessor.swift +262 -0
- package/package/index.d.ts +4 -2
- package/package/index.js +6 -3
- package/package/index.js.map +1 -0
- package/package/src/api/facetec.d.ts +3 -0
- package/package/src/api/facetec.js +109 -0
- package/package/src/api/facetec.js.map +1 -0
- package/package/src/bridges/facetec.d.ts +2 -0
- package/package/src/bridges/facetec.js +105 -0
- package/package/src/bridges/facetec.js.map +1 -0
- package/package/src/bridges/passkey.d.ts +17 -0
- package/package/src/bridges/passkey.js +103 -0
- package/package/src/bridges/passkey.js.map +1 -0
- package/package/src/constants.d.ts +3 -2
- package/package/src/constants.js +4 -3
- package/package/src/constants.js.map +1 -0
- package/package/src/core.d.ts +3 -5
- package/package/src/core.jsx +42 -111
- package/package/src/core.jsx.map +1 -0
- package/package/src/facetec-bridge.d.ts +10 -0
- package/package/src/facetec-bridge.js +125 -0
- package/package/src/facetec-bridge.js.map +1 -0
- package/package/src/inapp-browser.d.ts +21 -0
- package/package/src/inapp-browser.js +104 -0
- package/package/src/inapp-browser.js.map +1 -0
- package/package/src/passkey-bridge.d.ts +17 -0
- package/package/src/passkey-bridge.js +103 -0
- package/package/src/passkey-bridge.js.map +1 -0
- package/package/src/types.d.ts +27 -13
- package/package/src/types.js.map +1 -0
- package/package/src/utils/apiDate.d.ts +1 -0
- package/package/src/utils/apiDate.js +5 -0
- package/package/src/utils/apiDate.js.map +1 -0
- package/package/src/utils/color.d.ts +5 -0
- package/package/src/utils/color.js +35 -0
- package/package/src/utils/color.js.map +1 -0
- package/package/src/utils/date.d.ts +1 -0
- package/package/src/utils/date.js +6 -0
- package/package/src/utils/date.js.map +1 -0
- package/package/src/utils/index.d.ts +4 -0
- package/package/src/utils/index.js +12 -0
- package/package/src/utils/index.js.map +1 -0
- package/package/src/utils/message-handler.d.ts +3 -0
- package/package/src/utils/message-handler.js +76 -0
- package/package/src/utils/message-handler.js.map +1 -0
- package/package/src/utils/platform.d.ts +1 -0
- package/package/src/utils/platform.js +9 -0
- package/package/src/utils/platform.js.map +1 -0
- package/package/src/utils/type-guards.d.ts +4 -0
- package/package/src/utils/type-guards.js +15 -0
- package/package/src/utils/type-guards.js.map +1 -0
- package/package/src/utils/url-builder.d.ts +2 -0
- package/package/src/utils/url-builder.js +70 -0
- package/package/src/utils/url-builder.js.map +1 -0
- package/package/src/webview.d.ts +3 -0
- package/package/src/webview.jsx +65 -0
- package/package/src/webview.jsx.map +1 -0
- package/package.json +14 -12
- package/react-native.config.js +14 -0
- package/soyio_rn_sdk.podspec +49 -0
- package/package/src/utils.d.ts +0 -17
- package/package/src/utils.js +0 -157
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
- Install using npm
|
|
17
|
+
- Install using npm (or your favorite package manager)
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
20
|
# Using npm
|
|
@@ -24,22 +24,147 @@ npm install @soyio/soyio-rn-sdk
|
|
|
24
24
|
yarn add @soyio/soyio-rn-sdk
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
-
|
|
27
|
+
- You'll also need to install the required peer dependencies:
|
|
28
28
|
|
|
29
|
-
```
|
|
30
|
-
|
|
29
|
+
```sh
|
|
30
|
+
# Using npm
|
|
31
|
+
npm install react-native-webview react-native-inappbrowser-reborn
|
|
32
|
+
|
|
33
|
+
# Using yarn
|
|
34
|
+
yarn add react-native-webview react-native-inappbrowser-reborn
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**iOS Setup:** Run `cd ios && pod install` to install native dependencies.
|
|
38
|
+
|
|
39
|
+
**Android Setup:** For React Native 0.60+, auto-linking should handle Android setup automatically. For older versions, follow the [manual linking guide](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Getting-Started.md).
|
|
40
|
+
|
|
41
|
+
## Android setup (repositories, permissions, deep links)
|
|
42
|
+
|
|
43
|
+
Add these to your app so bundled native dependencies and deep linking work when consuming the SDK from npm.
|
|
44
|
+
|
|
45
|
+
1) Repositories (`android/settings.gradle`) - **Only required if you want to use NFC validation**
|
|
46
|
+
|
|
47
|
+
```gradle
|
|
48
|
+
dependencyResolutionManagement {
|
|
49
|
+
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
|
|
50
|
+
repositories {
|
|
51
|
+
// Keep your normal repositories here (e.g., google(), mavenCentral()) as appropriate for your project/architecture.
|
|
52
|
+
// Add this flatDir so bundled native dependencies are resolvable:
|
|
53
|
+
flatDir {
|
|
54
|
+
dirs(
|
|
55
|
+
"$rootDir/../node_modules/@soyio/soyio-rn-sdk/android/libs",
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
2) Manifest entries (`android/app/src/main/AndroidManifest.xml` inside `<manifest>`)
|
|
63
|
+
|
|
64
|
+
```xml
|
|
65
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
66
|
+
<uses-permission android:name="android.permission.CAMERA" />
|
|
67
|
+
<uses-feature android:name="android.hardware.camera" android:required="true" />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
If you want to enable NFC validation with the `SoyioWidget`, also add:
|
|
71
|
+
|
|
72
|
+
```xml
|
|
73
|
+
<uses-permission android:name="android.permission.NFC" />
|
|
74
|
+
<uses-feature android:name="android.hardware.nfc" android:required="false" />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
3) Deep link for returning from the in-app browser: add an intent filter in your main `<activity>` with your chosen scheme (must match `uriScheme` passed to the SDK)
|
|
78
|
+
|
|
79
|
+
```xml
|
|
80
|
+
<intent-filter>
|
|
81
|
+
<action android:name="android.intent.action.VIEW" />
|
|
82
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
83
|
+
<category android:name="android.intent.category.BROWSABLE" />
|
|
84
|
+
<data android:scheme="your-app-scheme" />
|
|
85
|
+
</intent-filter>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
After changes, rebuild the Android app (`cd android && ./gradlew :app:assembleDebug` or `yarn android`).
|
|
89
|
+
|
|
90
|
+
## iOS Setup (permissions, NFC, deep links)
|
|
91
|
+
|
|
92
|
+
Add these to your app so native dependencies, NFC scanning, and deep linking work when consuming the SDK from npm.
|
|
93
|
+
|
|
94
|
+
### 1. Native Dependencies
|
|
95
|
+
|
|
96
|
+
After installing the package and peer dependencies, run:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
cd ios && pod install
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 2. Permissions
|
|
103
|
+
|
|
104
|
+
Add the following permissions to your `ios/YourApp/Info.plist` file:
|
|
105
|
+
|
|
106
|
+
```xml
|
|
107
|
+
<key>NSCameraUsageDescription</key>
|
|
108
|
+
<string>This app needs access to camera for document verification</string>
|
|
31
109
|
```
|
|
32
110
|
|
|
33
|
-
|
|
111
|
+
If you want to enable NFC validation with the `SoyioWidget`, also add:
|
|
34
112
|
|
|
35
|
-
|
|
36
|
-
|
|
113
|
+
```xml
|
|
114
|
+
<key>NFCReaderUsageDescription</key>
|
|
115
|
+
<string>This app needs access to NFC for identity document verification</string>
|
|
37
116
|
|
|
38
|
-
|
|
117
|
+
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
|
|
118
|
+
<array>
|
|
119
|
+
<string>A0000002471001</string>
|
|
120
|
+
<string>A0000002472001</string>
|
|
121
|
+
</array>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 3. NFC Entitlements
|
|
125
|
+
|
|
126
|
+
For NFC to work, you also need to create (or update) your entitlements file at `ios/YourApp/YourApp.entitlements`:
|
|
127
|
+
|
|
128
|
+
```xml
|
|
129
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
130
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
131
|
+
<plist version="1.0">
|
|
132
|
+
<dict>
|
|
133
|
+
<key>com.apple.developer.nfc.readersession.formats</key>
|
|
134
|
+
<array>
|
|
135
|
+
<string>TAG</string>
|
|
136
|
+
</array>
|
|
137
|
+
</dict>
|
|
138
|
+
</plist>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Then, in Xcode, ensure the entitlements file is linked to your target:
|
|
142
|
+
1. Select your project in Xcode
|
|
143
|
+
2. Go to your app target's **Signing & Capabilities** tab
|
|
144
|
+
3. Add **Near Field Communication Tag Reading** capability (if not already added)
|
|
145
|
+
4. Verify the entitlements file path is set in **Build Settings → Code Signing Entitlements**
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
## URI Scheme Setup
|
|
149
|
+
|
|
150
|
+
You need to configure a custom URI scheme for your application to handle deep linking properly:
|
|
151
|
+
|
|
152
|
+
```sh
|
|
153
|
+
npx uri-scheme add custom-uri-scheme
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Replace `custom-uri-scheme` with your desired scheme name. This scheme should match the `uriScheme` parameter you use in the `SoyioWidget` options.
|
|
39
157
|
|
|
40
158
|
## Usage
|
|
41
159
|
|
|
42
|
-
`Soyio React Native`
|
|
160
|
+
`Soyio React Native` provides two ways to integrate the Soyio verification flow:
|
|
161
|
+
|
|
162
|
+
1. **Component**: A `SoyioWidget` component that renders a WebView within your app.
|
|
163
|
+
2. **InAppBrowser Functions**: Direct functions that open the verification flow in an in-app browser.
|
|
164
|
+
|
|
165
|
+
> ℹ️ **NFC validation** is only available when you integrate with the `SoyioWidget` component (WebView). The InAppBrowser mode does not support NFC.
|
|
166
|
+
|
|
167
|
+
## Component Integration
|
|
43
168
|
|
|
44
169
|
### 1. Disclosure Request
|
|
45
170
|
|
|
@@ -57,40 +182,44 @@ To instantiate this process in the code, you have two options:
|
|
|
57
182
|
This doesn't require any previous setup. Given your company and disclosure template IDs, you can create disclosure requests freely when the user starts the widget:
|
|
58
183
|
|
|
59
184
|
```jsx
|
|
60
|
-
import {
|
|
185
|
+
import { View, StyleSheet } from "react-native";
|
|
186
|
+
import { SoyioWidget } from "@soyio/soyio-rn-sdk";
|
|
61
187
|
|
|
62
188
|
export default function App() {
|
|
63
189
|
const options = {
|
|
64
|
-
|
|
65
|
-
|
|
190
|
+
uriScheme: "<your-app-scheme>", // Required: Your app's URI scheme
|
|
191
|
+
companyId: "<company id>", // Optional: Starts with 'com_'
|
|
66
192
|
userReference: "<company identifier of user>", // Optional
|
|
67
|
-
|
|
68
|
-
isSandbox: true, // Optional
|
|
193
|
+
isSandbox: true, // Optional
|
|
69
194
|
};
|
|
70
195
|
|
|
71
196
|
// For initialize a disclosure request
|
|
72
197
|
const disclosureParams = {
|
|
73
|
-
templateId: "<template id>",
|
|
74
|
-
userEmail: "<user email>",
|
|
75
|
-
forceError: '<error type>', // Optional
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const onEventChange = (event) => {
|
|
79
|
-
console.log("Event:", event);
|
|
198
|
+
templateId: "<template id>", // Starts with 'dtpl_'
|
|
199
|
+
userEmail: "<user email>", // Optional
|
|
80
200
|
};
|
|
81
201
|
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
const initDisclosureRequest = () => {
|
|
85
|
-
disclosure(disclosureParams);
|
|
202
|
+
const handleSuccess = () => {
|
|
203
|
+
console.log("Verification successful!");
|
|
86
204
|
};
|
|
87
205
|
|
|
88
206
|
return (
|
|
89
|
-
<View>
|
|
90
|
-
<
|
|
207
|
+
<View style={styles.container}>
|
|
208
|
+
<SoyioWidget
|
|
209
|
+
options={options}
|
|
210
|
+
requestType="disclosure"
|
|
211
|
+
requestParams={disclosureParams}
|
|
212
|
+
onSuccess={handleSuccess}
|
|
213
|
+
/>
|
|
91
214
|
</View>
|
|
92
215
|
);
|
|
93
216
|
}
|
|
217
|
+
|
|
218
|
+
const styles = StyleSheet.create({
|
|
219
|
+
container: {
|
|
220
|
+
flex: 1,
|
|
221
|
+
},
|
|
222
|
+
});
|
|
94
223
|
```
|
|
95
224
|
|
|
96
225
|
#### 1.b Created disclosure request:
|
|
@@ -102,38 +231,41 @@ For more details about the use case, please refer to [the documentation](https:/
|
|
|
102
231
|
To use this option, simply specify the disclosure request ID along with any optional parameters:
|
|
103
232
|
|
|
104
233
|
```jsx
|
|
105
|
-
import {
|
|
234
|
+
import { View, StyleSheet } from "react-native";
|
|
235
|
+
import { SoyioWidget } from "@soyio/soyio-rn-sdk";
|
|
106
236
|
|
|
107
237
|
export default function App() {
|
|
108
238
|
const options = {
|
|
109
|
-
uriScheme: "<
|
|
110
|
-
|
|
111
|
-
isSandbox: false, // Optional
|
|
239
|
+
uriScheme: "<your-app-scheme>", // Required: Your app's URI scheme
|
|
240
|
+
isSandbox: false, // Optional
|
|
112
241
|
};
|
|
113
242
|
|
|
114
243
|
// For initialize a disclosure request
|
|
115
244
|
const disclosureParams = {
|
|
116
|
-
disclosureRequestId: "<disclosure request id>",
|
|
117
|
-
userEmail: "<user email>", // Optional
|
|
118
|
-
forceError: '<error type>', // Optional
|
|
245
|
+
disclosureRequestId: "<disclosure request id>", // Starts with 'dreq_'
|
|
119
246
|
};
|
|
120
247
|
|
|
121
|
-
const
|
|
122
|
-
console.log("
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const { disclosure } = useSoyioAuth({ options, onEventChange });
|
|
126
|
-
|
|
127
|
-
const initDisclosureRequest = () => {
|
|
128
|
-
disclosure(disclosureParams);
|
|
248
|
+
const handleSuccess = () => {
|
|
249
|
+
console.log("Verification successful!");
|
|
129
250
|
};
|
|
130
251
|
|
|
131
252
|
return (
|
|
132
|
-
<View>
|
|
133
|
-
<
|
|
253
|
+
<View style={styles.container}>
|
|
254
|
+
<SoyioWidget
|
|
255
|
+
options={options}
|
|
256
|
+
requestType="disclosure"
|
|
257
|
+
requestParams={disclosureParams}
|
|
258
|
+
onSuccess={handleSuccess}
|
|
259
|
+
/>
|
|
134
260
|
</View>
|
|
135
261
|
);
|
|
136
262
|
}
|
|
263
|
+
|
|
264
|
+
const styles = StyleSheet.create({
|
|
265
|
+
container: {
|
|
266
|
+
flex: 1,
|
|
267
|
+
},
|
|
268
|
+
});
|
|
137
269
|
```
|
|
138
270
|
|
|
139
271
|
Note that user and template properties are not specified here because they must be specified when creating the disclosure request beforehand.
|
|
@@ -143,97 +275,147 @@ Note that user and template properties are not specified here because they must
|
|
|
143
275
|
The **`auth_request`** is a process where, using a previously created `auth_request_id`, a request is initiated in which a user can authenticate with Soyio. This authentication can occur either through an access key or facial video.
|
|
144
276
|
|
|
145
277
|
```jsx
|
|
146
|
-
import {
|
|
278
|
+
import { View, StyleSheet } from "react-native";
|
|
279
|
+
import { SoyioWidget } from "@soyio/soyio-rn-sdk";
|
|
147
280
|
|
|
148
281
|
export default function App() {
|
|
149
282
|
const options = {
|
|
150
|
-
uriScheme: "<
|
|
151
|
-
|
|
152
|
-
isSandbox: false, // Optional
|
|
283
|
+
uriScheme: "<your-app-scheme>", // Required: Your app's URI scheme
|
|
284
|
+
isSandbox: false, // Optional
|
|
153
285
|
};
|
|
154
286
|
|
|
155
287
|
const authRequestParams = {
|
|
156
|
-
authRequestId: "<auth request id>" // Starts with 'authreq_'
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const onEventChange = (event) => {
|
|
160
|
-
console.log("Event:", event);
|
|
288
|
+
authRequestId: "<auth request id>", // Starts with 'authreq_'
|
|
161
289
|
};
|
|
162
290
|
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
const initAuthRequest = () => {
|
|
166
|
-
authentication(authRequestParams);
|
|
291
|
+
const handleSuccess = () => {
|
|
292
|
+
console.log("Authentication successful!");
|
|
167
293
|
};
|
|
168
294
|
|
|
169
295
|
return (
|
|
170
|
-
<View>
|
|
171
|
-
<
|
|
296
|
+
<View style={styles.container}>
|
|
297
|
+
<SoyioWidget
|
|
298
|
+
options={options}
|
|
299
|
+
requestType="authentication_request"
|
|
300
|
+
requestParams={authRequestParams}
|
|
301
|
+
onSuccess={handleSuccess}
|
|
302
|
+
/>
|
|
172
303
|
</View>
|
|
173
304
|
);
|
|
174
305
|
}
|
|
306
|
+
|
|
307
|
+
const styles = StyleSheet.create({
|
|
308
|
+
container: {
|
|
309
|
+
flex: 1,
|
|
310
|
+
},
|
|
311
|
+
});
|
|
175
312
|
```
|
|
176
313
|
|
|
177
|
-
|
|
314
|
+
### Event Handling
|
|
178
315
|
|
|
179
|
-
|
|
316
|
+
The `SoyioWidget` component supports the following event handlers:
|
|
180
317
|
|
|
181
|
-
|
|
182
|
-
{
|
|
183
|
-
type: "success",
|
|
184
|
-
request: "disclosure" | "authRequest",
|
|
185
|
-
verificationKind: "validation" | "authentication",
|
|
186
|
-
userReference: "<company-user-reference>",
|
|
187
|
-
identityId: "<soyio-identity-id-of-user>",
|
|
188
|
-
}
|
|
189
|
-
```
|
|
318
|
+
- **`onSuccess`**: Called when the verification/authentication process completes successfully
|
|
190
319
|
|
|
191
|
-
|
|
320
|
+
## InAppBrowser Integration
|
|
192
321
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
322
|
+
For cases where you prefer to open the verification flow in an in-app browser instead of a WebView, you can use the direct function approach.
|
|
323
|
+
|
|
324
|
+
### 1. Disclosure Request (InAppBrowser)
|
|
325
|
+
|
|
326
|
+
#### 1.a Disclosure request on-the-fly:
|
|
327
|
+
|
|
328
|
+
```jsx
|
|
329
|
+
import { openDisclosure } from "@soyio/soyio-rn-sdk";
|
|
330
|
+
|
|
331
|
+
const handleDisclosure = async () => {
|
|
332
|
+
const options = {
|
|
333
|
+
uriScheme: "<your-app-scheme>", // Required: Your app's URI scheme
|
|
334
|
+
companyId: "<company id>", // Optional: Starts with 'com_'
|
|
335
|
+
userReference: "<company identifier of user>", // Optional
|
|
336
|
+
isSandbox: true, // Optional
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
const disclosureParams = {
|
|
340
|
+
templateId: "<template id>", // Starts with 'dtpl_'
|
|
341
|
+
userEmail: "<user email>", // Optional
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
await openDisclosure({
|
|
345
|
+
options,
|
|
346
|
+
requestParams: disclosureParams,
|
|
347
|
+
onComplete: () => console.log("Disclosure completed successfully!"),
|
|
348
|
+
onCancel: () => console.log("Disclosure was cancelled by user"),
|
|
349
|
+
});
|
|
350
|
+
};
|
|
197
351
|
```
|
|
198
352
|
|
|
199
|
-
|
|
353
|
+
#### 1.b Created disclosure request:
|
|
200
354
|
|
|
201
|
-
```
|
|
202
|
-
{
|
|
203
|
-
|
|
204
|
-
|
|
355
|
+
```jsx
|
|
356
|
+
import { openDisclosure } from "@soyio/soyio-rn-sdk";
|
|
357
|
+
|
|
358
|
+
const handleDisclosure = async () => {
|
|
359
|
+
const options = {
|
|
360
|
+
uriScheme: "<your-app-scheme>", // Required: Your app's URI scheme
|
|
361
|
+
isSandbox: false, // Optional
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
const disclosureParams = {
|
|
365
|
+
disclosureRequestId: "<disclosure request id>", // Starts with 'dreq_'
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
await openDisclosure({
|
|
369
|
+
options,
|
|
370
|
+
requestParams: disclosureParams,
|
|
371
|
+
onComplete: () => console.log("Disclosure completed successfully!"),
|
|
372
|
+
onCancel: () => console.log("Disclosure was cancelled by user"),
|
|
373
|
+
});
|
|
374
|
+
};
|
|
205
375
|
```
|
|
206
376
|
|
|
207
|
-
|
|
377
|
+
### 2. Auth Request (InAppBrowser)
|
|
208
378
|
|
|
209
|
-
```
|
|
210
|
-
{
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
379
|
+
```jsx
|
|
380
|
+
import { openAuthenticationRequest } from "@soyio/soyio-rn-sdk";
|
|
381
|
+
|
|
382
|
+
const handleAuthRequest = async () => {
|
|
383
|
+
const options = {
|
|
384
|
+
uriScheme: "<your-app-scheme>", // Required: Your app's URI scheme
|
|
385
|
+
isSandbox: false, // Optional
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
const authRequestParams = {
|
|
389
|
+
authRequestId: "<auth request id>", // Starts with 'authreq_'
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
await openAuthenticationRequest({
|
|
393
|
+
options,
|
|
394
|
+
requestParams: authRequestParams,
|
|
395
|
+
onComplete: () => console.log("Authentication completed successfully!"),
|
|
396
|
+
onCancel: () => console.log("Authentication was cancelled by user"),
|
|
397
|
+
});
|
|
398
|
+
};
|
|
215
399
|
```
|
|
216
400
|
|
|
217
|
-
|
|
401
|
+
### Event Handling (InAppBrowser)
|
|
218
402
|
|
|
219
|
-
|
|
220
|
-
- **`userReference`**: (Optional) A reference identifier provided by the company for the user engaging with the widget. This identifier is used in events (`onEvent` and `webhooks`) to inform the company which user the events are associated with.
|
|
221
|
-
- **`userEmail`**: The user's email address.
|
|
222
|
-
- **`forceError`**: (Optional) Triggers specific errors for testing or debugging. Used to simulate failure scenarios.
|
|
223
|
-
- **`templateId`**: Identifier of template. Specifies the order and quantity of documents requested from the user, as well as the mandatory data that the user is asked to share with the company. It must start with `'datmp_'`.
|
|
224
|
-
- **`customColor`**: (Optional) A hex code string that specifies the base color of the interface
|
|
225
|
-
- **`isSandbox`**: (Optional) Indicates if the widget should operate in sandbox mode, defaulting to `false`.
|
|
226
|
-
- **`uriScheme`**: The unique redirect scheme you've set with `npx uri-scheme add ...`, critical for redirect handling in your app.
|
|
227
|
-
- **`authRequestId`**: Identifier of auth request obtained when creating the `AuthRequest`. It must start with `'authreq_'`.
|
|
403
|
+
The InAppBrowser functions support the following callback handlers:
|
|
228
404
|
|
|
229
|
-
|
|
405
|
+
- **`onComplete`**: Called when the verification/authentication process completes successfully
|
|
406
|
+
- **`onCancel`**: Called when the user cancels the process or navigates away
|
|
230
407
|
|
|
231
|
-
|
|
408
|
+
#### Attribute Descriptions
|
|
232
409
|
|
|
233
|
-
-
|
|
234
|
-
-
|
|
235
|
-
-
|
|
236
|
-
-
|
|
410
|
+
- **`uriScheme`**: (Required) The URI scheme for your application, used for deep linking and navigation.
|
|
411
|
+
- **`companyId`**: (Optional) The unique identifier for the company, must start with `'com_'`.
|
|
412
|
+
- **`userReference`**: (Optional) A reference identifier provided by the company for the user engaging with the widget. This identifier is used in events (`onEvent` and `webhooks`) to inform the company which user the events are associated with.
|
|
413
|
+
- **`userEmail`**: (Optional) The user's email address.
|
|
414
|
+
- **`templateId`**: (Required for new disclosure requests) Identifier of template. Specifies the order and quantity of documents requested from the user, as well as the mandatory data that the user is asked to share with the company. It must start with `'dtpl_'`.
|
|
415
|
+
- **`isSandbox`**: (Optional) Indicates if the widget should operate in sandbox mode, defaulting to `false`.
|
|
416
|
+
- **`developmentUrl`**: (Optional) Custom development URL for testing purposes.
|
|
417
|
+
- **`authRequestId`**: (Required for authentication requests) Identifier of auth request obtained when creating the `AuthRequest`. It must start with `'authreq_'`.
|
|
418
|
+
- **`disclosureRequestId`**: (Required for existing disclosure requests) Identifier of an existing disclosure request. It must start with `'dreq_'`.
|
|
237
419
|
|
|
238
420
|
#### TypeScript support
|
|
239
421
|
|
|
@@ -241,10 +423,10 @@ This package includes TypeScript declarations.
|
|
|
241
423
|
|
|
242
424
|
#### Developing
|
|
243
425
|
|
|
244
|
-
To develop the package, you need to use `
|
|
426
|
+
To develop the package, you need to use `yarn`. Install the dependencies:
|
|
245
427
|
|
|
246
428
|
```sh
|
|
247
|
-
|
|
429
|
+
yarn install
|
|
248
430
|
```
|
|
249
431
|
|
|
250
432
|
To test locally, I recommend packaging the app. Remember to build the library first:
|
|
@@ -253,30 +435,3 @@ To test locally, I recommend packaging the app. Remember to build the library fi
|
|
|
253
435
|
npm run build
|
|
254
436
|
npm pack
|
|
255
437
|
```
|
|
256
|
-
|
|
257
|
-
This will create a `soyio-soyio-rn-sdk-x.x.x.tgz` file (with the corresponding package version). Now, go to another directory and create a React Native app (using Expo, perhaps). After creating the new application, add the following dependency to its `package.json` file:
|
|
258
|
-
|
|
259
|
-
```json
|
|
260
|
-
{
|
|
261
|
-
"dependencies": {
|
|
262
|
-
...,
|
|
263
|
-
"@soyio/soyio-rn-sdk": "file:./path/to/soyio-soyio-rn-sdk-x.x.x.tgz",
|
|
264
|
-
...
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Where `./path/to/soyio-soyio-rn-sdk-x.x.x.tgz` corresponds to the path to the `.tgz` file created on the `npm pack` step. After running `npm install` on the new React Native app, you should be able to use Soyio React Native to import the Soyio View.
|
|
270
|
-
|
|
271
|
-
If you want to create a new _release_, you can run:
|
|
272
|
-
|
|
273
|
-
```sh
|
|
274
|
-
git switch main
|
|
275
|
-
npm run bump! <major|minor|patch>
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
This will create a new branch with the updated version from `main`.
|
|
279
|
-
|
|
280
|
-
## Acknowledgements
|
|
281
|
-
|
|
282
|
-
This implementation was written based on the input and experience of [**fintoc**](https://github.com/fintoc-com/fintoc-react-native) integrating the WebView using React Native, which served as a good starting point for the general idea of this library.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
3
|
+
|
|
4
|
+
def safeExtGet(prop, fallback) {
|
|
5
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
android {
|
|
9
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 34)
|
|
10
|
+
def javaVersion = safeExtGet('javaVersion', JavaVersion.VERSION_17)
|
|
11
|
+
|
|
12
|
+
defaultConfig {
|
|
13
|
+
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
14
|
+
targetSdkVersion safeExtGet('targetSdkVersion', 34)
|
|
15
|
+
versionCode 1
|
|
16
|
+
versionName "1.0"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
buildTypes {
|
|
20
|
+
release {
|
|
21
|
+
minifyEnabled false
|
|
22
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
compileOptions {
|
|
27
|
+
sourceCompatibility javaVersion
|
|
28
|
+
targetCompatibility javaVersion
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
kotlinOptions {
|
|
32
|
+
jvmTarget = javaVersion.toString()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
sourceSets {
|
|
36
|
+
main {
|
|
37
|
+
assets.srcDirs += ['../assets']
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
repositories {
|
|
43
|
+
flatDir {
|
|
44
|
+
dirs 'libs'
|
|
45
|
+
}
|
|
46
|
+
google()
|
|
47
|
+
mavenCentral()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
dependencies {
|
|
51
|
+
def kotlinVersion = safeExtGet('kotlinVersion', '1.8.0')
|
|
52
|
+
implementation "com.facebook.react:react-native:+"
|
|
53
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
54
|
+
implementation(name: "facetec-sdk-9.7.96", ext: "aar")
|
|
55
|
+
implementation "com.squareup.okhttp3:okhttp:3.12.13"
|
|
56
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
package="com.soyio.soyiorndk">
|
|
4
|
+
|
|
5
|
+
<!-- Add any permissions your module needs here -->
|
|
6
|
+
<!-- Example: <uses-permission android:name="android.permission.INTERNET" /> -->
|
|
7
|
+
|
|
8
|
+
</manifest>
|