@soyio/soyio-rn-sdk 5.0.0 → 6.0.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 +28 -112
- package/package/src/bridges/facetec.js +16 -8
- package/package/src/bridges/facetec.js.map +1 -1
- package/package.json +9 -7
- package/android/build.gradle +0 -57
- package/android/libs/facetec-sdk-9.7.114.aar +0 -0
- package/android/src/main/AndroidManifest.xml +0 -8
- package/android/src/main/java/com/soyio/soyiorndk/AndroidFacetecSdkModule.kt +0 -224
- package/android/src/main/java/com/soyio/soyiorndk/AndroidFacetecSdkPackage.kt +0 -16
- package/android/src/main/java/com/soyio/soyiorndk/ApiDate.kt +0 -5
- package/android/src/main/java/com/soyio/soyiorndk/BaseFaceTecProcessor.kt +0 -75
- package/android/src/main/java/com/soyio/soyiorndk/FaceTecRequestService.kt +0 -115
- package/android/src/main/java/com/soyio/soyiorndk/FacetecConfig.kt +0 -311
- package/android/src/main/java/com/soyio/soyiorndk/SoyioIdOnlyProcessor.kt +0 -81
- package/android/src/main/java/com/soyio/soyiorndk/SoyioValidationProcessor.kt +0 -136
- package/android/src/main/res/drawable-nodpi/soyio_facetec_close.png +0 -0
- package/android/src/main/res/drawable-nodpi/soyio_facetec_id_front.png +0 -0
- package/android/src/main/res/values/strings.xml +0 -134
- 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 +0 -23
- 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 +0 -23
- 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/ios/ApiDate.swift +0 -5
- package/ios/FacetecConfig.swift +0 -217
- package/ios/FacetecStrings.swift +0 -139
- package/ios/Frameworks/FaceTecSDK.xcframework/Info.plist +0 -44
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Assets.car +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/FaceTecSDK +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/GenericGuidanceContentLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Headers/FaceTecPublicApi.h +0 -1935
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Headers/FaceTecPublicStringKeys.h +0 -109
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Headers/FaceTecSDK.h +0 -16
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Info.plist +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Modules/module.modulemap +0 -6
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/PrivacyInfo.xcprivacy +0 -29
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/ReadyScreenGuidanceContentLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/RetryScreenGuidanceContentLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/SharedGuidanceLayout.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/9Uo-4b-JiE-view-Ae0-rb-UqS.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/CJ6-MX-bJp-view-8JL-Rc-0g1.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/FaceScanViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/FaceTecAdditionalReviewViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/FaceTecIDFeedbackViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/FaceTecOCRConfirmationViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/IDCaptureViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/IDSelectionViewController.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/Info.plist +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/Pyw-6G-JSY-view-Zue-Eo-Q2U.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/QWA-8Y-vUM-view-wJB-Z5-eD2.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/alz-Ia-X3d-view-IKu-EI-Hug.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/Storyboard.storyboardc/l2Q-cc-kD8-view-UUy-6c-meu.nib +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/_CodeSignature/CodeResources +0 -729
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/af.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/ar.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/attributions.txt +0 -462
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/1f5b84f51ce0fcfbb76e904b7bcaa7560f601e1394a0b29367a09385312287eb +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/2b075ac1a6132b5b8a4c9ef0ba6b0cd84db7838aca9a000e50d907f40770a4ab +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/59cc2a9af81aaca2376702c2490650f4da2775fa673274db98aad41b7ef101c0 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/5b63e98b991aedabb60665503384f30bffd939decf9433883b30b78011ee501a +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/66388dc76dc16bc6b76b682edd218a575bf45b9b +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/6b3133f0f39ff89a2a169d61176ee17cafacc5e288f334e2b64ee82892d11ccd +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/9077d16225f9314163ef1e7db6fc7d4088bb903d134bd95f23d5591ca4dfbfca +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/a74f2afb9d20f2375ccbd14e67c094b85c89ceb608f7cf8ae04f3f646a6c5672 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/b501893e75f62ee1707643e35b21109927b07ed5b202321c961b424cbc2e4695 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/dbd7a353f0130bb983d6ba05917e9be991d70e8f028df4b74e30bc6497ef7f71 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/f2.xml +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/fd6d368a5658496536e2bfae170d1b823a3629b242cafc09784bfba4e56d8c80 +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/marker +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/cache_uyertuazlkxcjrlwkejr/39bb748b334003e3fa/vu0ilin6we3lrzo5f83f7qs2jul4aq7v4aoynrmch8zfvpi8ezrfyafa4t0fx87l +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/de.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/el.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/en.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/es.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/fr.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/kk.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/nb.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/pt-BR.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/ru.lproj/FaceTec.strings +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64/FaceTecSDK.framework/strip-unused-architectures-from-target.sh +0 -62
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/FaceTecSDK +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Headers/FaceTecPublicApi.h +0 -1935
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Headers/FaceTecPublicStringKeys.h +0 -109
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Headers/FaceTecSDK.h +0 -16
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Info.plist +0 -0
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/Modules/module.modulemap +0 -6
- package/ios/Frameworks/FaceTecSDK.xcframework/ios-arm64_x86_64-simulator/FaceTecSDK.framework/_CodeSignature/CodeResources +0 -146
- package/ios/IOSFacetecSdk.m +0 -22
- package/ios/IOSFacetecSdk.swift +0 -221
- package/ios/ProcessorProtocol.swift +0 -6
- package/ios/SoyioIDOnlyProcessor.swift +0 -170
- package/ios/SoyioPhotoIDMatchProcessor.swift +0 -264
- package/package/package.json +0 -68
- package/react-native.config.js +0 -12
- package/scripts/prepare-facetec-xcframework.sh +0 -38
- package/soyio_rn_sdk.podspec +0 -52
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
- Install using npm (or your favorite package manager)
|
|
17
|
+
- Install the core SDK using npm (or your favorite package manager)
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
20
|
# Using npm
|
|
@@ -34,47 +34,42 @@ npm install react-native-webview react-native-inappbrowser-reborn
|
|
|
34
34
|
yarn add react-native-webview react-native-inappbrowser-reborn
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
The core package covers:
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
- `ConsentBox`
|
|
40
|
+
- WebView disclosure flows
|
|
41
|
+
- in-app browser disclosure/authentication flows
|
|
42
|
+
- passkey browser flows
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
If your disclosure flow requires the native FaceTec-backed experience, install the addon as well:
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
```sh
|
|
47
|
+
# Using npm
|
|
48
|
+
npm install @soyio/soyio-rn-sdk-native-disclosure
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
}
|
|
50
|
+
# Using yarn
|
|
51
|
+
yarn add @soyio/soyio-rn-sdk-native-disclosure
|
|
60
52
|
```
|
|
61
53
|
|
|
62
|
-
|
|
54
|
+
The addon is the only package that bundles the native iOS and Android disclosure implementation, including FaceTec, camera usage, and NFC-specific setup.
|
|
63
55
|
|
|
64
|
-
|
|
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
|
-
```
|
|
56
|
+
## iOS Setup
|
|
69
57
|
|
|
70
|
-
|
|
58
|
+
Run `cd ios && pod install` after installing your dependencies.
|
|
71
59
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
- If you install only `@soyio/soyio-rn-sdk`, no Soyio-specific camera or NFC permissions are required.
|
|
61
|
+
- If you also install `@soyio/soyio-rn-sdk-native-disclosure`, follow that package's README for camera permissions, NFC entitlements, and native disclosure setup.
|
|
62
|
+
|
|
63
|
+
## Android Setup
|
|
76
64
|
|
|
77
|
-
|
|
65
|
+
For React Native 0.60+, auto-linking should handle Android setup automatically.
|
|
66
|
+
|
|
67
|
+
- If you install only `@soyio/soyio-rn-sdk`, there are no Soyio-specific Android camera or NFC requirements.
|
|
68
|
+
- If you also install `@soyio/soyio-rn-sdk-native-disclosure`, follow that package's README for the additional native disclosure setup.
|
|
69
|
+
|
|
70
|
+
## Deep Link Setup
|
|
71
|
+
|
|
72
|
+
Add an intent filter in your main `<activity>` with your chosen scheme. This must match the `uriScheme` passed to the SDK.
|
|
78
73
|
|
|
79
74
|
```xml
|
|
80
75
|
<intent-filter>
|
|
@@ -85,85 +80,6 @@ If you want to enable NFC validation with the `SoyioWidget`, also add:
|
|
|
85
80
|
</intent-filter>
|
|
86
81
|
```
|
|
87
82
|
|
|
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. Apple Silicon Simulator Compatibility
|
|
103
|
-
|
|
104
|
-
`FaceTecSDK.framework` ships with `x86_64` for simulator and `arm64` for physical devices. On Apple Silicon Macs, iOS simulator builds may fail when Xcode tries to link the device `arm64` slice.
|
|
105
|
-
|
|
106
|
-
From this SDK version onward, the podspec excludes `arm64` for `iphonesimulator` builds so simulator builds use `x86_64`.
|
|
107
|
-
|
|
108
|
-
If you are integrating an older SDK version, add this to your app `Podfile`:
|
|
109
|
-
|
|
110
|
-
```ruby
|
|
111
|
-
post_install do |installer|
|
|
112
|
-
installer.pods_project.targets.each do |target|
|
|
113
|
-
if target.name == 'soyio_rn_sdk'
|
|
114
|
-
target.build_configurations.each do |config|
|
|
115
|
-
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### 3. Permissions
|
|
123
|
-
|
|
124
|
-
Add the following permissions to your `ios/YourApp/Info.plist` file:
|
|
125
|
-
|
|
126
|
-
```xml
|
|
127
|
-
<key>NSCameraUsageDescription</key>
|
|
128
|
-
<string>This app needs access to camera for document verification</string>
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
If you want to enable NFC validation with the `SoyioWidget`, also add:
|
|
132
|
-
|
|
133
|
-
```xml
|
|
134
|
-
<key>NFCReaderUsageDescription</key>
|
|
135
|
-
<string>This app needs access to NFC for identity document verification</string>
|
|
136
|
-
|
|
137
|
-
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
|
|
138
|
-
<array>
|
|
139
|
-
<string>A0000002471001</string>
|
|
140
|
-
<string>A0000002472001</string>
|
|
141
|
-
</array>
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### 4. NFC Entitlements
|
|
145
|
-
|
|
146
|
-
For NFC to work, you also need to create (or update) your entitlements file at `ios/YourApp/YourApp.entitlements`:
|
|
147
|
-
|
|
148
|
-
```xml
|
|
149
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
150
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
151
|
-
<plist version="1.0">
|
|
152
|
-
<dict>
|
|
153
|
-
<key>com.apple.developer.nfc.readersession.formats</key>
|
|
154
|
-
<array>
|
|
155
|
-
<string>TAG</string>
|
|
156
|
-
</array>
|
|
157
|
-
</dict>
|
|
158
|
-
</plist>
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
Then, in Xcode, ensure the entitlements file is linked to your target:
|
|
162
|
-
1. Select your project in Xcode
|
|
163
|
-
2. Go to your app target's **Signing & Capabilities** tab
|
|
164
|
-
3. Add **Near Field Communication Tag Reading** capability (if not already added)
|
|
165
|
-
4. Verify the entitlements file path is set in **Build Settings → Code Signing Entitlements**
|
|
166
|
-
|
|
167
83
|
|
|
168
84
|
## URI Scheme Setup
|
|
169
85
|
|
|
@@ -182,7 +98,7 @@ Replace `custom-uri-scheme` with your desired scheme name. This scheme should ma
|
|
|
182
98
|
1. **Component**: A `SoyioWidget` component that renders a WebView within your app.
|
|
183
99
|
2. **InAppBrowser Functions**: Direct functions that open the verification flow in an in-app browser.
|
|
184
100
|
|
|
185
|
-
> ℹ️ **NFC validation** is only available when you integrate with the `SoyioWidget` component (WebView). The InAppBrowser mode does not support
|
|
101
|
+
> ℹ️ **Native disclosure / NFC validation** is only available when you install `@soyio/soyio-rn-sdk-native-disclosure` and integrate with the `SoyioWidget` component (WebView). The InAppBrowser mode does not support it.
|
|
186
102
|
|
|
187
103
|
## Component Integration
|
|
188
104
|
|
|
@@ -39,16 +39,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.handleFaceTecVerification = void 0;
|
|
40
40
|
var react_native_1 = require("react-native");
|
|
41
41
|
var facetec_1 = require("../api/facetec");
|
|
42
|
-
var
|
|
43
|
-
|
|
42
|
+
var MISSING_NATIVE_DISCLOSURE_ERROR = 'Native disclosure is not installed. Add @soyio/soyio-rn-sdk-native-disclosure to enable FACETEC disclosure flows.';
|
|
43
|
+
function getFaceTecModule() {
|
|
44
|
+
var nativeModule = react_native_1.Platform.OS === 'ios'
|
|
45
|
+
? react_native_1.NativeModules.IOSFacetecSdk
|
|
46
|
+
: react_native_1.NativeModules.AndroidFacetecSdk;
|
|
47
|
+
return nativeModule !== null && nativeModule !== void 0 ? nativeModule : null;
|
|
48
|
+
}
|
|
44
49
|
var handleFaceTecVerification = function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
-
var livenessSubscription, credentials, initResult, facetecSessionToken, verificationConfig, result, _a, errorType;
|
|
50
|
+
var faceTecModule, faceTecEmitter, livenessSubscription, credentials, initResult, facetecSessionToken, verificationConfig, result, _a, errorType;
|
|
46
51
|
var _b;
|
|
47
52
|
return __generator(this, function (_c) {
|
|
48
53
|
switch (_c.label) {
|
|
49
54
|
case 0:
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
faceTecModule = getFaceTecModule();
|
|
56
|
+
if (!faceTecModule) {
|
|
57
|
+
throw new Error(MISSING_NATIVE_DISCLOSURE_ERROR);
|
|
58
|
+
}
|
|
59
|
+
faceTecEmitter = new react_native_1.NativeEventEmitter(faceTecModule);
|
|
52
60
|
livenessSubscription = config.mode === 'liveness-and-id' && config.onLivenessSuccess
|
|
53
61
|
? faceTecEmitter.addListener('onLivenessSuccess', config.onLivenessSuccess)
|
|
54
62
|
: null;
|
|
@@ -58,7 +66,7 @@ var handleFaceTecVerification = function (config) { return __awaiter(void 0, voi
|
|
|
58
66
|
return [4 /*yield*/, (0, facetec_1.getFaceTecCredentials)(config.baseUrl, config.soyioSessionToken)];
|
|
59
67
|
case 2:
|
|
60
68
|
credentials = _c.sent();
|
|
61
|
-
return [4 /*yield*/,
|
|
69
|
+
return [4 /*yield*/, faceTecModule.initializeFaceTecSDK({
|
|
62
70
|
deviceKey: credentials.deviceKey,
|
|
63
71
|
publicKey: credentials.publicKey,
|
|
64
72
|
mobileProductionKey: credentials.mobileProductionKey,
|
|
@@ -78,11 +86,11 @@ var handleFaceTecVerification = function (config) { return __awaiter(void 0, voi
|
|
|
78
86
|
baseUrl: config.baseUrl,
|
|
79
87
|
};
|
|
80
88
|
if (!(config.mode === 'liveness-and-id')) return [3 /*break*/, 6];
|
|
81
|
-
return [4 /*yield*/,
|
|
89
|
+
return [4 /*yield*/, faceTecModule.startLivenessAndIDVerification(verificationConfig)];
|
|
82
90
|
case 5:
|
|
83
91
|
_a = _c.sent();
|
|
84
92
|
return [3 /*break*/, 8];
|
|
85
|
-
case 6: return [4 /*yield*/,
|
|
93
|
+
case 6: return [4 /*yield*/, faceTecModule.startIDOnlyVerification(verificationConfig)];
|
|
86
94
|
case 7:
|
|
87
95
|
_a = _c.sent();
|
|
88
96
|
_c.label = 8;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facetec.js","sourceRoot":"/","sources":["src/bridges/facetec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2E;AAE3E,0CAA+E;AA8B/E,IAAM,
|
|
1
|
+
{"version":3,"file":"facetec.js","sourceRoot":"/","sources":["src/bridges/facetec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2E;AAE3E,0CAA+E;AA8B/E,IAAM,+BAA+B,GAAG,mHAAmH,CAAC;AAE5J,SAAS,gBAAgB;IACvB,IAAM,YAAY,GAAG,uBAAQ,CAAC,EAAE,KAAK,KAAK;QACxC,CAAC,CAAC,4BAAa,CAAC,aAAa;QAC7B,CAAC,CAAC,4BAAa,CAAC,iBAAiB,CAAC;IAEpC,OAAO,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,IAAI,CAAC;AAC9B,CAAC;AAEM,IAAM,yBAAyB,GAAG,UACvC,MAAiC;;;;;;gBAE3B,aAAa,GAAG,gBAAgB,EAAE,CAAC;gBAEzC,IAAI,CAAC,aAAa,EAAE,CAAC;oBACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBACnD,CAAC;gBAEK,cAAc,GAAG,IAAI,iCAAkB,CAAC,aAAa,CAAC,CAAC;gBAEvD,oBAAoB,GAAG,MAAM,CAAC,IAAI,KAAK,iBAAiB,IAAI,MAAM,CAAC,iBAAiB;oBACxF,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,mBAAmB,EAAE,MAAM,CAAC,iBAAiB,CAAC;oBAC3E,CAAC,CAAC,IAAI,CAAC;;;;gBAGa,qBAAM,IAAA,+BAAqB,EAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAAA;;gBAAnF,WAAW,GAAG,SAAqE;gBAEtE,qBAAM,aAAa,CAAC,oBAAoB,CAAC;wBAC1D,SAAS,EAAE,WAAW,CAAC,SAAS;wBAChC,SAAS,EAAE,WAAW,CAAC,SAAS;wBAChC,mBAAmB,EAAE,WAAW,CAAC,mBAAmB;wBACpD,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI;qBAC5B,CAAC,EAAA;;gBALI,UAAU,GAAG,SAKjB;gBAEF,IAAI,CAAC,UAAU,CAAC,OAAO;oBAAE,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,kCAAkC,CAAC,CAAC;gBAErE,qBAAM,IAAA,gCAAsB,EACtD,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,iBAAiB,CACzB,EAAA;;gBAHK,mBAAmB,GAAG,SAG3B;gBAEK,kBAAkB,GAAG;oBACzB,mBAAmB,qBAAA;oBACnB,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;oBAC3C,sBAAsB,EAAE,MAAM,CAAC,sBAAsB;oBACrD,OAAO,EAAE,MAAM,CAAC,OAAO;iBACxB,CAAC;qBAEa,CAAA,MAAM,CAAC,IAAI,KAAK,iBAAiB,CAAA,EAAjC,wBAAiC;gBAC5C,qBAAM,aAAa,CAAC,8BAA8B,CAAC,kBAAkB,CAAC,EAAA;;gBAAtE,KAAA,SAAsE,CAAA;;oBACtE,qBAAM,aAAa,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,EAAA;;gBAA/D,KAAA,SAA+D,CAAA;;;gBAF7D,MAAM,KAEuD;gBAEnE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;oBACd,SAAS,GAAG,MAAM,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,sBAAsB,CAAC;oBAC9F,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,uCAAgC,SAAS,CAAE,CAAC,CAAC;gBAC/E,CAAC;gBAED,MAAA,MAAM,CAAC,UAAU,sDAAI,CAAC;;;gBAEtB,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,MAAM,EAAE,CAAC;;;;;KAElC,CAAC;AApDW,QAAA,yBAAyB,6BAoDpC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyio/soyio-rn-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Ignacio Méndez",
|
|
6
6
|
"main": "./package/index.js",
|
|
7
7
|
"react-native": "./package/index.js",
|
|
8
8
|
"description": "Soyio React Native SDK",
|
|
9
|
-
"homepage": "https://
|
|
9
|
+
"homepage": "https://docs.soyio.id/",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/Soyio-id/soyio
|
|
12
|
+
"url": "git+https://github.com/Soyio-id/soyio.git",
|
|
13
|
+
"directory": "sdks/soyio-rn-sdk"
|
|
13
14
|
},
|
|
14
15
|
"types": "./package/index.d.ts",
|
|
15
16
|
"scripts": {
|
|
@@ -17,14 +18,15 @@
|
|
|
17
18
|
"start": "react-native start",
|
|
18
19
|
"android": "react-native run-android",
|
|
19
20
|
"ios": "react-native run-ios",
|
|
20
|
-
"build": "
|
|
21
|
+
"build": "rm -rf package && pnpm build:esm && pnpm build:cjs",
|
|
21
22
|
"build:esm": "tsc",
|
|
22
23
|
"build:cjs": "tsc --module commonjs",
|
|
23
24
|
"lint": "eslint src index.ts --ext .ts",
|
|
24
|
-
"smoke:setup": "cd example/app &&
|
|
25
|
+
"smoke:setup": "cd example/app && pnpm install --no-frozen-lockfile",
|
|
25
26
|
"smoke:android": "./scripts/smoke-android.sh",
|
|
26
|
-
"smoke:ios": "cd example/app &&
|
|
27
|
+
"smoke:ios": "cd example/app && pnpm ios",
|
|
27
28
|
"version:get": "node -p \"require('./package.json').version\"",
|
|
29
|
+
"version:set:addon": "node scripts/set-addon-version.js",
|
|
28
30
|
"sync:api-date": "node scripts/update-api-date.js",
|
|
29
31
|
"pack:dev": "sh scripts/pack-dev.sh"
|
|
30
32
|
},
|
|
@@ -64,5 +66,5 @@
|
|
|
64
66
|
"overrides": {
|
|
65
67
|
"js-yaml": "^4.1.1"
|
|
66
68
|
},
|
|
67
|
-
"packageManager": "
|
|
69
|
+
"packageManager": "pnpm@10.19.0"
|
|
68
70
|
}
|
package/android/build.gradle
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
namespace "com.soyio.soyiorndk"
|
|
11
|
-
def javaVersion = safeExtGet('javaVersion', JavaVersion.VERSION_17)
|
|
12
|
-
|
|
13
|
-
defaultConfig {
|
|
14
|
-
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
15
|
-
targetSdkVersion safeExtGet('targetSdkVersion', 34)
|
|
16
|
-
versionCode 1
|
|
17
|
-
versionName "1.0"
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
buildTypes {
|
|
21
|
-
release {
|
|
22
|
-
minifyEnabled false
|
|
23
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
compileOptions {
|
|
28
|
-
sourceCompatibility javaVersion
|
|
29
|
-
targetCompatibility javaVersion
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
kotlinOptions {
|
|
33
|
-
jvmTarget = javaVersion.toString()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
sourceSets {
|
|
37
|
-
main {
|
|
38
|
-
assets.srcDirs += ['../assets']
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
repositories {
|
|
44
|
-
flatDir {
|
|
45
|
-
dirs 'libs'
|
|
46
|
-
}
|
|
47
|
-
google()
|
|
48
|
-
mavenCentral()
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
dependencies {
|
|
52
|
-
def kotlinVersion = safeExtGet('kotlinVersion', '1.8.0')
|
|
53
|
-
implementation "com.facebook.react:react-native:+"
|
|
54
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
|
55
|
-
implementation(name: "facetec-sdk-9.7.114", ext: "aar")
|
|
56
|
-
implementation "com.squareup.okhttp3:okhttp:3.12.13"
|
|
57
|
-
}
|
|
Binary file
|
|
@@ -1,8 +0,0 @@
|
|
|
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>
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
package com.soyio.soyiorndk
|
|
2
|
-
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import com.facebook.react.bridge.*
|
|
5
|
-
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
6
|
-
import com.facetec.sdk.FaceTecSDK
|
|
7
|
-
|
|
8
|
-
class AndroidFacetecSdkModule(reactContext: ReactApplicationContext) :
|
|
9
|
-
ReactContextBaseJavaModule(reactContext) {
|
|
10
|
-
|
|
11
|
-
private var isInitialized = false
|
|
12
|
-
|
|
13
|
-
override fun getName(): String = NAME
|
|
14
|
-
|
|
15
|
-
@ReactMethod
|
|
16
|
-
fun addListener(eventName: String) {
|
|
17
|
-
// No-op: required for NativeEventEmitter support
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@ReactMethod
|
|
21
|
-
fun removeListeners(count: Int) {
|
|
22
|
-
// No-op
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@ReactMethod
|
|
26
|
-
fun initialize(options: ReadableMap, promise: Promise) {
|
|
27
|
-
if (isInitialized) {
|
|
28
|
-
val result = Arguments.createMap().apply { putBoolean("success", true) }
|
|
29
|
-
promise.resolve(result)
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
val productionKeyText = options.getRequiredString(MOBILE_PRODUCTION_KEY_TEXT, promise) ?: return
|
|
34
|
-
val deviceKeyIdentifier = options.getRequiredString(DEVICE_KEY_IDENTIFIER, promise) ?: return
|
|
35
|
-
val publicFaceScanEncryptionKey = options.getRequiredString(PUBLIC_FACE_SCAN_KEY, promise) ?: return
|
|
36
|
-
|
|
37
|
-
val activity: Activity? = currentActivity
|
|
38
|
-
val context = activity ?: reactApplicationContext
|
|
39
|
-
|
|
40
|
-
val initializeSdk = {
|
|
41
|
-
val theme = if (options.hasKey(THEME) && !options.isNull(THEME)) options.getMap(THEME) else null
|
|
42
|
-
FacetecConfig.apply(reactApplicationContext, theme)
|
|
43
|
-
|
|
44
|
-
val callback = { successful: Boolean ->
|
|
45
|
-
isInitialized = successful
|
|
46
|
-
if (successful) {
|
|
47
|
-
val result = Arguments.createMap().apply { putBoolean("success", true) }
|
|
48
|
-
promise.resolve(result)
|
|
49
|
-
} else {
|
|
50
|
-
val result = Arguments.createMap().apply {
|
|
51
|
-
putBoolean("success", false)
|
|
52
|
-
putString("error", "FaceTec SDK did not finish initialization. Verify the provided keys and device settings.")
|
|
53
|
-
}
|
|
54
|
-
promise.resolve(result)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
FaceTecSDK.initializeInProductionMode(
|
|
59
|
-
context,
|
|
60
|
-
productionKeyText,
|
|
61
|
-
deviceKeyIdentifier,
|
|
62
|
-
publicFaceScanEncryptionKey,
|
|
63
|
-
callback,
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (UiThreadUtil.isOnUiThread()) {
|
|
68
|
-
initializeSdk()
|
|
69
|
-
} else {
|
|
70
|
-
UiThreadUtil.runOnUiThread(initializeSdk)
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@ReactMethod
|
|
75
|
-
fun initializeFaceTecSDK(config: ReadableMap, promise: Promise) {
|
|
76
|
-
val mapped = Arguments.createMap().apply {
|
|
77
|
-
putString(MOBILE_PRODUCTION_KEY_TEXT, config.getString("mobileProductionKey") ?: "")
|
|
78
|
-
putString(DEVICE_KEY_IDENTIFIER, config.getString("deviceKey") ?: "")
|
|
79
|
-
putString(PUBLIC_FACE_SCAN_KEY, config.getString("publicKey") ?: "")
|
|
80
|
-
if (config.hasKey("theme") && !config.isNull("theme")) {
|
|
81
|
-
putMap(THEME, config.getMap("theme"))
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
initialize(mapped, promise)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
@ReactMethod
|
|
88
|
-
fun startLivenessSession(options: ReadableMap, promise: Promise) {
|
|
89
|
-
if (!isInitialized) {
|
|
90
|
-
promise.reject(FACETEC_NOT_INITIALIZED, "Initialize FaceTec SDK before starting a session.")
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
val sessionToken = options.getRequiredString(SESSION_TOKEN, promise) ?: return
|
|
95
|
-
val requestableToken = options.getRequiredString(REQUESTABLE_TOKEN, promise) ?: return
|
|
96
|
-
val resourcePath = options.getRequiredString(RESOURCE_PATH, promise) ?: return
|
|
97
|
-
val baseUrl = options.getRequiredString(BASE_URL, promise) ?: return
|
|
98
|
-
val authToken = options.getRequiredString(AUTH_TOKEN, promise) ?: return
|
|
99
|
-
val isIdOnly = if (options.hasKey(IS_ID_ONLY)) options.getBoolean(IS_ID_ONLY) else false
|
|
100
|
-
|
|
101
|
-
val activity: Activity? = currentActivity
|
|
102
|
-
if (activity == null) {
|
|
103
|
-
promise.reject(NO_ACTIVITY, "Unable to access current Activity to show FaceTec UI.")
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (isIdOnly) {
|
|
108
|
-
SoyioIdOnlyProcessor(
|
|
109
|
-
activity,
|
|
110
|
-
sessionToken,
|
|
111
|
-
baseUrl,
|
|
112
|
-
resourcePath,
|
|
113
|
-
requestableToken,
|
|
114
|
-
authToken,
|
|
115
|
-
promise,
|
|
116
|
-
)
|
|
117
|
-
} else {
|
|
118
|
-
SoyioValidationProcessor(
|
|
119
|
-
activity,
|
|
120
|
-
sessionToken,
|
|
121
|
-
baseUrl,
|
|
122
|
-
resourcePath,
|
|
123
|
-
requestableToken,
|
|
124
|
-
authToken,
|
|
125
|
-
promise,
|
|
126
|
-
{ sendEvent(LIVENESS_SUCCESS_EVENT, null) },
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
@ReactMethod
|
|
132
|
-
fun startLivenessAndIDVerification(config: ReadableMap, promise: Promise) {
|
|
133
|
-
startVerification(config, promise, false)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
@ReactMethod
|
|
137
|
-
fun startIDOnlyVerification(config: ReadableMap, promise: Promise) {
|
|
138
|
-
startVerification(config, promise, true)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
private fun startVerification(config: ReadableMap, promise: Promise, isIdOnly: Boolean) {
|
|
142
|
-
val facetecToken = config.getString("facetecSessionToken")
|
|
143
|
-
val soyioToken = config.getString("soyioSessionToken")
|
|
144
|
-
val requestableToken = config.getString("disclosureRequestToken")
|
|
145
|
-
val baseUrl = config.getString("baseUrl")
|
|
146
|
-
|
|
147
|
-
if (facetecToken.isNullOrBlank() || soyioToken.isNullOrBlank() || requestableToken.isNullOrBlank() || baseUrl.isNullOrBlank()) {
|
|
148
|
-
promise.reject(FACETEC_INVALID_CONFIG, "Invalid FaceTec verification configuration.")
|
|
149
|
-
return
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
val resourcePath = try {
|
|
153
|
-
mapTokenToResourcePath(requestableToken)
|
|
154
|
-
} catch (error: IllegalArgumentException) {
|
|
155
|
-
promise.reject(FACETEC_INVALID_CONFIG, error.message)
|
|
156
|
-
return
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
val options = Arguments.createMap().apply {
|
|
160
|
-
putString(SESSION_TOKEN, facetecToken)
|
|
161
|
-
putString(REQUESTABLE_TOKEN, requestableToken)
|
|
162
|
-
putString(RESOURCE_PATH, resourcePath)
|
|
163
|
-
putString(BASE_URL, baseUrl)
|
|
164
|
-
putString(AUTH_TOKEN, soyioToken)
|
|
165
|
-
putBoolean(IS_ID_ONLY, isIdOnly)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
startLivenessSession(options, promise)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
private fun ReadableMap.getRequiredString(key: String, promise: Promise): String? {
|
|
172
|
-
if (!hasKey(key)) {
|
|
173
|
-
promise.reject(MISSING_OPTION, "Missing required FaceTec initialization field: $key")
|
|
174
|
-
return null
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
val value = getString(key)
|
|
178
|
-
if (value.isNullOrBlank()) {
|
|
179
|
-
promise.reject(MISSING_OPTION, "Field '$key' must be a non-empty string")
|
|
180
|
-
return null
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return value
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
companion object {
|
|
187
|
-
const val NAME = "AndroidFacetecSdk"
|
|
188
|
-
private const val MOBILE_PRODUCTION_KEY_TEXT = "mobileProductionKeyText"
|
|
189
|
-
private const val DEVICE_KEY_IDENTIFIER = "deviceKeyIdentifier"
|
|
190
|
-
private const val PUBLIC_FACE_SCAN_KEY = "publicFaceScanEncryptionKey"
|
|
191
|
-
private const val FACETEC_INIT_FAILED = "FACETEC_INIT_FAILED"
|
|
192
|
-
private const val MISSING_OPTION = "FACETEC_INIT_OPTION_MISSING"
|
|
193
|
-
private const val FACETEC_NOT_INITIALIZED = "FACETEC_NOT_INITIALIZED"
|
|
194
|
-
private const val NO_ACTIVITY = "FACETEC_NO_ACTIVITY"
|
|
195
|
-
private const val SESSION_TOKEN = "sessionToken"
|
|
196
|
-
private const val REQUESTABLE_TOKEN = "requestableToken"
|
|
197
|
-
private const val RESOURCE_PATH = "resourcePath"
|
|
198
|
-
private const val BASE_URL = "baseUrl"
|
|
199
|
-
private const val AUTH_TOKEN = "authToken"
|
|
200
|
-
private const val IS_ID_ONLY = "isIdOnly"
|
|
201
|
-
private const val THEME = "theme"
|
|
202
|
-
private const val FACETEC_INVALID_CONFIG = "FACETEC_INVALID_CONFIG"
|
|
203
|
-
private const val LIVENESS_SUCCESS_EVENT = "onLivenessSuccess"
|
|
204
|
-
private val TOKEN_PREFIXES = mapOf(
|
|
205
|
-
"dreq_" to "disclosure_requests",
|
|
206
|
-
"dsreq_" to "data_subject_requests",
|
|
207
|
-
"authreq_" to "auth_requests",
|
|
208
|
-
"va_" to "validation_attempts",
|
|
209
|
-
"aa_" to "auth_attempts",
|
|
210
|
-
"sa_" to "signature_attempts",
|
|
211
|
-
)
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
private fun mapTokenToResourcePath(token: String): String {
|
|
215
|
-
return TOKEN_PREFIXES.entries.firstOrNull { token.startsWith(it.key) }?.value
|
|
216
|
-
?: throw IllegalArgumentException("Unrecognized token prefix for $token")
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
private fun sendEvent(event: String, params: WritableMap?) {
|
|
220
|
-
reactApplicationContext
|
|
221
|
-
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
222
|
-
.emit(event, params)
|
|
223
|
-
}
|
|
224
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
package com.soyio.soyiorndk
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.ReactPackage
|
|
4
|
-
import com.facebook.react.bridge.NativeModule
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.uimanager.ViewManager
|
|
7
|
-
|
|
8
|
-
class AndroidFacetecSdkPackage : ReactPackage {
|
|
9
|
-
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
10
|
-
return listOf(AndroidFacetecSdkModule(reactContext))
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
14
|
-
return emptyList()
|
|
15
|
-
}
|
|
16
|
-
}
|