@au10tixorg/secureme-sdk 4.7.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/LICENSE +21 -0
- package/README.md +479 -0
- package/android/build.gradle +156 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/com/securemesdk/SecuremeSdkModule.kt +59 -0
- package/android/src/main/java/com/securemesdk/SecuremeSdkPackage.kt +17 -0
- package/android/src/main/java/com/securemesdk/helpers/ReadableMapExt.kt +51 -0
- package/android/src/main/java/com/securemesdk/helpers/SessionParser.kt +21 -0
- package/android/src/main/java/com/securemesdk/models/SDKError.kt +24 -0
- package/android/src/main/java/com/securemesdk/secureme/SecureMeBottomSheet.kt +308 -0
- package/ios/Extensions/DictionaryExtensions.swift +90 -0
- package/ios/Extensions/SecureMeExtensions.swift +82 -0
- package/ios/Models/SDKError.swift +36 -0
- package/ios/Secureme/SecuremeService.swift +261 -0
- package/ios/SecuremeSdk-Bridging-Header.h +2 -0
- package/ios/SecuremeSdk.m +14 -0
- package/ios/SecuremeSdk.swift +102 -0
- package/ios/SecuremeSdk.xcodeproj/project.pbxproj +317 -0
- package/ios/SecuremeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/lib/commonjs/index.js +103 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/index.js +85 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/index.d.ts +32 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +95 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +164 -0
- package/secureme-sdk.podspec +27 -0
- package/src/index.tsx +119 -0
- package/src/types.ts +113 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 SecureMe SDK Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
# SecureMe SDK
|
|
2
|
+
|
|
3
|
+
React Native library for SecureMe integration (iOS & Android).
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Node.js 14+ and npm
|
|
10
|
+
- React Native development environment
|
|
11
|
+
- For iOS: Xcode and CocoaPods
|
|
12
|
+
- For Android: Android Studio and Java
|
|
13
|
+
|
|
14
|
+
## 📖 Documentation
|
|
15
|
+
|
|
16
|
+
For a comprehensive overview of features, configuration options, and integration steps, please see the **[Integration Guide (GUIDE.md)](GUIDE.md)**.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
### Building the Library
|
|
21
|
+
|
|
22
|
+
1. **Clone the repository**
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
git clone <repository-url>
|
|
26
|
+
cd reactnative-secure.me-sdk
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
2. **Install dependencies**
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
yarn install
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
3. **Build the library**
|
|
36
|
+
```sh
|
|
37
|
+
npx react-native-builder-bob build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Clean Rebuild
|
|
41
|
+
|
|
42
|
+
To perform a complete clean rebuild:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
# Clean all build artifacts and dependencies
|
|
46
|
+
rm -rf lib node_modules package-lock.json yarn.lock .yarn/cache .yarn/install-state.gz example/node_modules example/package-lock.json example/ios/Pods example/ios/Podfile.lock
|
|
47
|
+
|
|
48
|
+
# Reinstall and rebuild
|
|
49
|
+
yarn install
|
|
50
|
+
npx react-native-builder-bob build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Available Scripts
|
|
54
|
+
|
|
55
|
+
- `yarn run typescript` - Type check with TypeScript
|
|
56
|
+
- `yarn run lint` - Lint code with ESLint
|
|
57
|
+
- `npx react-native-builder-bob build` - Build the library (via react-native-builder-bob)
|
|
58
|
+
- `yarn test` - Run tests
|
|
59
|
+
- `yarn run example` - Run commands in the example app
|
|
60
|
+
- `yarn run pods` - Install iOS pods for the example app
|
|
61
|
+
|
|
62
|
+
## iOS Setup
|
|
63
|
+
|
|
64
|
+
### 1. Install Pods
|
|
65
|
+
|
|
66
|
+
Go to your project's iOS folder and install dependencies:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
cd ios
|
|
70
|
+
pod install
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Android Setup
|
|
74
|
+
|
|
75
|
+
### 1. Minimum SDK Version
|
|
76
|
+
|
|
77
|
+
Ensure your `android/build.gradle` has minimum SDK version 21 or higher:
|
|
78
|
+
|
|
79
|
+
```gradle
|
|
80
|
+
buildscript {
|
|
81
|
+
ext {
|
|
82
|
+
minSdkVersion = 21
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Usage
|
|
88
|
+
|
|
89
|
+
Here is a basic example of how to integrate the SDK into your application.
|
|
90
|
+
|
|
91
|
+
> **Note:** Use Named Import with curly braces `{ SecuremeSdk }`.
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import React, { useEffect, useState } from 'react';
|
|
95
|
+
import {
|
|
96
|
+
SafeAreaView,
|
|
97
|
+
View,
|
|
98
|
+
Text,
|
|
99
|
+
Button,
|
|
100
|
+
StyleSheet,
|
|
101
|
+
Alert,
|
|
102
|
+
ActivityIndicator,
|
|
103
|
+
Linking,
|
|
104
|
+
Platform,
|
|
105
|
+
PermissionsAndroid,
|
|
106
|
+
} from 'react-native';
|
|
107
|
+
|
|
108
|
+
import { SecuremeSdk, SMFlow, SMConfig } from 'secureme-sdk';
|
|
109
|
+
|
|
110
|
+
// Define your flow configuration for both platforms
|
|
111
|
+
const smFlow: SMFlow = {
|
|
112
|
+
android: {
|
|
113
|
+
sdcFront: { enabled: true, showIntro: true, enableFileUpload: true },
|
|
114
|
+
sdcBack: { enabled: true, enableFileUpload: true, sendFeatureResult: true },
|
|
115
|
+
pfl: { enabled: true, showIntro: true, sendFeatureResult: true },
|
|
116
|
+
},
|
|
117
|
+
ios: {
|
|
118
|
+
sdcFront: {
|
|
119
|
+
showIntro: true,
|
|
120
|
+
enableFileUpload: true,
|
|
121
|
+
sendFeatureResult: true,
|
|
122
|
+
localClassification: false,
|
|
123
|
+
},
|
|
124
|
+
sdcBack: {
|
|
125
|
+
showIntro: true,
|
|
126
|
+
enableFileUpload: true,
|
|
127
|
+
sendFeatureResult: true,
|
|
128
|
+
},
|
|
129
|
+
pfl: {
|
|
130
|
+
showIntro: true,
|
|
131
|
+
sendFeatureResult: true,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Define your configuration for both platforms
|
|
137
|
+
const smConfig: SMConfig = {
|
|
138
|
+
android: {
|
|
139
|
+
withPflDetectionDelay: false,
|
|
140
|
+
pflDelaySecs: 0,
|
|
141
|
+
sendResults: true,
|
|
142
|
+
},
|
|
143
|
+
ios: {
|
|
144
|
+
pflDetectionDelayEnabled: false,
|
|
145
|
+
pflDelay: 0.0,
|
|
146
|
+
sendResults: true,
|
|
147
|
+
voiceConsentSessionTime: 20,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Your workflow data from the API
|
|
152
|
+
const WORKFLOW_DATA = `{
|
|
153
|
+
"sessionId": "YOUR_SESSION_ID",
|
|
154
|
+
"response": {
|
|
155
|
+
"session": "...",
|
|
156
|
+
"accessToken": "...",
|
|
157
|
+
"assets": [...]
|
|
158
|
+
},
|
|
159
|
+
"statusCode": 200
|
|
160
|
+
}`;
|
|
161
|
+
|
|
162
|
+
const App = () => {
|
|
163
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
164
|
+
const [cameraStatus, setCameraStatus] = useState<boolean>(false);
|
|
165
|
+
|
|
166
|
+
const requestCameraAccess = async (): Promise<boolean> => {
|
|
167
|
+
if (Platform.OS === 'android') {
|
|
168
|
+
try {
|
|
169
|
+
const granted = await PermissionsAndroid.request(
|
|
170
|
+
PermissionsAndroid.PERMISSIONS.CAMERA,
|
|
171
|
+
{
|
|
172
|
+
title: 'Camera Permission',
|
|
173
|
+
message: 'This app needs camera access for identity verification.',
|
|
174
|
+
buttonNeutral: 'Ask Me Later',
|
|
175
|
+
buttonNegative: 'Cancel',
|
|
176
|
+
buttonPositive: 'OK',
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
return granted === PermissionsAndroid.RESULTS.GRANTED;
|
|
180
|
+
} catch (err) {
|
|
181
|
+
console.warn(err);
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
// iOS - permission handled by SecuremeSdk
|
|
186
|
+
const hasPermission = await SecuremeSdk.requestCameraPermission();
|
|
187
|
+
return hasPermission;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
const setupSDK = async () => {
|
|
193
|
+
try {
|
|
194
|
+
console.log('🚀 Starting SDK Setup...');
|
|
195
|
+
|
|
196
|
+
const hasPermission = await requestCameraAccess();
|
|
197
|
+
console.log('📷 Camera Status:', hasPermission);
|
|
198
|
+
setCameraStatus(hasPermission);
|
|
199
|
+
} catch (error: any) {
|
|
200
|
+
console.error('❌ Setup Failed:', error);
|
|
201
|
+
Alert.alert('Setup Error', error.message || 'Unknown error');
|
|
202
|
+
} finally {
|
|
203
|
+
setIsLoading(false);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
setupSDK();
|
|
208
|
+
}, []);
|
|
209
|
+
|
|
210
|
+
const handleStartKit = async () => {
|
|
211
|
+
if (!cameraStatus) {
|
|
212
|
+
Alert.alert(
|
|
213
|
+
'Camera Permission Required',
|
|
214
|
+
'We need camera access to verify your identity.',
|
|
215
|
+
[
|
|
216
|
+
{ text: 'Cancel', style: 'cancel' },
|
|
217
|
+
{ text: 'Open Settings', onPress: () => Linking.openSettings() },
|
|
218
|
+
]
|
|
219
|
+
);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
try {
|
|
224
|
+
console.log('📱 Opening SecureMe Kit...');
|
|
225
|
+
const result = await SecuremeSdk.start(WORKFLOW_DATA, smFlow, smConfig);
|
|
226
|
+
Alert.alert('Success', 'Verification was successful!');
|
|
227
|
+
console.log('🏁 Flow finished with result:', result);
|
|
228
|
+
} catch (error: any) {
|
|
229
|
+
console.error('❌ Failed to open Kit:', error);
|
|
230
|
+
Alert.alert('Error', error.message);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<SafeAreaView style={styles.container}>
|
|
236
|
+
<View style={styles.content}>
|
|
237
|
+
<Text style={styles.title}>SecureMe Integration</Text>
|
|
238
|
+
|
|
239
|
+
{isLoading ? (
|
|
240
|
+
<View>
|
|
241
|
+
<ActivityIndicator size="large" color="#0000ff" />
|
|
242
|
+
<Text style={styles.loadingText}>
|
|
243
|
+
Checking permissions & initializing...
|
|
244
|
+
</Text>
|
|
245
|
+
</View>
|
|
246
|
+
) : (
|
|
247
|
+
<View style={styles.infoContainer}>
|
|
248
|
+
<Text style={styles.statusRow}>
|
|
249
|
+
Camera: {cameraStatus ? '✅ Allowed' : '❌ Denied'}
|
|
250
|
+
</Text>
|
|
251
|
+
|
|
252
|
+
<View style={styles.buttonContainer}>
|
|
253
|
+
<Button
|
|
254
|
+
title="Start SecureMe"
|
|
255
|
+
onPress={handleStartKit}
|
|
256
|
+
disabled={!cameraStatus}
|
|
257
|
+
/>
|
|
258
|
+
</View>
|
|
259
|
+
</View>
|
|
260
|
+
)}
|
|
261
|
+
</View>
|
|
262
|
+
</SafeAreaView>
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const styles = StyleSheet.create({
|
|
267
|
+
container: { flex: 1, backgroundColor: '#F5F5F5' },
|
|
268
|
+
content: {
|
|
269
|
+
flex: 1,
|
|
270
|
+
justifyContent: 'center',
|
|
271
|
+
alignItems: 'center',
|
|
272
|
+
padding: 20,
|
|
273
|
+
},
|
|
274
|
+
title: { fontSize: 24, fontWeight: 'bold', marginBottom: 30, color: '#333' },
|
|
275
|
+
loadingText: { marginTop: 10, color: '#666' },
|
|
276
|
+
infoContainer: { width: '100%', alignItems: 'center' },
|
|
277
|
+
statusRow: { fontSize: 16, marginBottom: 10, color: '#444' },
|
|
278
|
+
buttonContainer: { marginTop: 20, width: '100%', marginBottom: 10 },
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
export default App;
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## API Reference
|
|
285
|
+
|
|
286
|
+
### Methods
|
|
287
|
+
|
|
288
|
+
#### `requestCameraPermission(): Promise<boolean>`
|
|
289
|
+
|
|
290
|
+
Requests camera permission (iOS only - Android handles via `PermissionsAndroid`).
|
|
291
|
+
|
|
292
|
+
**Returns:** `Promise<boolean>` - `true` if permission granted, `false` otherwise.
|
|
293
|
+
|
|
294
|
+
```tsx
|
|
295
|
+
const hasPermission = await SecuremeSdk.requestCameraPermission();
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
#### `start(workFlowResponse: string, flow: SMFlow, config: SMConfig): Promise<any>`
|
|
299
|
+
|
|
300
|
+
Starts the SecureMe verification flow.
|
|
301
|
+
|
|
302
|
+
**Parameters:**
|
|
303
|
+
|
|
304
|
+
- `workFlowResponse` (string): JSON string containing session data from your backend
|
|
305
|
+
- `flow` (SMFlow): Flow configuration for Android and/or iOS
|
|
306
|
+
- `config` (SMConfig): Additional configuration options for Android and/or iOS
|
|
307
|
+
|
|
308
|
+
**Returns:** `Promise<any>` - Result of the verification flow
|
|
309
|
+
|
|
310
|
+
```tsx
|
|
311
|
+
const result = await SecuremeSdk.start(WORKFLOW_DATA, smFlow, smConfig);
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Types
|
|
315
|
+
|
|
316
|
+
#### `SMFlow`
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
interface SMFlow {
|
|
320
|
+
android?: AndroidSMFlow;
|
|
321
|
+
ios?: IOSSMFlow;
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
#### `SMConfig`
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
interface SMConfig {
|
|
329
|
+
android?: AndroidSMConfig;
|
|
330
|
+
ios?: IOSSMConfig;
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
For detailed type definitions, see [types.ts](src/types.ts).
|
|
335
|
+
|
|
336
|
+
## Flow Features
|
|
337
|
+
|
|
338
|
+
### Android Features
|
|
339
|
+
|
|
340
|
+
- `sdcFront` - Front Document Capture
|
|
341
|
+
- `sdcBack` - Back Document Capture
|
|
342
|
+
- `pfl` - Passive Face Liveness
|
|
343
|
+
- `nfc` - NFC Passport Reading
|
|
344
|
+
- `poa` - Proof of Address
|
|
345
|
+
- `videoSession` - Video Session
|
|
346
|
+
- `voiceConsent` - Voice Consent
|
|
347
|
+
|
|
348
|
+
### iOS Features
|
|
349
|
+
|
|
350
|
+
- `sdcFront` - Front Smart Document Capture
|
|
351
|
+
- `sdcBack` - Back Smart Document Capture
|
|
352
|
+
- `pfl` - Passive Face Liveness
|
|
353
|
+
- `vc` - Voice Consent
|
|
354
|
+
- `vs` - Video Session
|
|
355
|
+
- `poa` - Proof of Address
|
|
356
|
+
- `sdcOcr` - OCR Document Capture
|
|
357
|
+
|
|
358
|
+
## Configuration Options
|
|
359
|
+
|
|
360
|
+
### Android Config
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
{
|
|
364
|
+
pflDelaySecs?: number;
|
|
365
|
+
sendResults?: boolean;
|
|
366
|
+
suspiciousConfig?: AndroidSuspiciousConfigType;
|
|
367
|
+
videoSessionAskUserConsent?: boolean;
|
|
368
|
+
videoSessionConsentTime?: number;
|
|
369
|
+
videoSessionIDTime?: number;
|
|
370
|
+
voiceConsentSessionTime?: number;
|
|
371
|
+
voiceConsentText?: string;
|
|
372
|
+
withPflDetectionDelay?: boolean;
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### iOS Config
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
{
|
|
380
|
+
pflDetectionDelayEnabled?: boolean;
|
|
381
|
+
pflDelay?: number;
|
|
382
|
+
sendResults?: boolean;
|
|
383
|
+
voiceConsentText?: string;
|
|
384
|
+
voiceConsentSessionTime?: number;
|
|
385
|
+
videoSessionText?: string;
|
|
386
|
+
videoSessionIdSessionDuration?: number;
|
|
387
|
+
videoSessionVoiceSessionDuration?: number;
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
## Troubleshooting
|
|
392
|
+
|
|
393
|
+
### iOS
|
|
394
|
+
|
|
395
|
+
**Issue:** Pod install fails
|
|
396
|
+
**Solution:** Try `cd ios && pod install --repo-update`
|
|
397
|
+
|
|
398
|
+
**Issue:** Camera permission not working
|
|
399
|
+
**Solution:** Ensure `NSCameraUsageDescription` is added to `Info.plist`
|
|
400
|
+
|
|
401
|
+
### Android
|
|
402
|
+
|
|
403
|
+
**Issue:** Build fails with dependency conflicts
|
|
404
|
+
**Solution:** Ensure your `minSdkVersion` is at least 21
|
|
405
|
+
|
|
406
|
+
**Issue:** Camera permission denied
|
|
407
|
+
**Solution:** Check that `CAMERA` permission is declared in `AndroidManifest.xml`
|
|
408
|
+
|
|
409
|
+
## Error Handling
|
|
410
|
+
|
|
411
|
+
The SDK can throw the following errors:
|
|
412
|
+
|
|
413
|
+
### Native Module Errors
|
|
414
|
+
|
|
415
|
+
- **LinkingError** — thrown when the native module is not properly linked (native binary missing or pods not installed).
|
|
416
|
+
- **PermissionError** — thrown when camera permissions are denied or unavailable.
|
|
417
|
+
- **ValidationError** — thrown when an invalid configuration or workflow payload is provided.
|
|
418
|
+
|
|
419
|
+
### Session Errors
|
|
420
|
+
|
|
421
|
+
- **SessionInitError** — failed to initialize session with provided workflow data.
|
|
422
|
+
- **NetworkError** — failed to communicate with backend services or token validation failed.
|
|
423
|
+
|
|
424
|
+
### Example Error Handling
|
|
425
|
+
|
|
426
|
+
Use guarded calls and inspect error messages or types to handle specific cases:
|
|
427
|
+
|
|
428
|
+
```tsx
|
|
429
|
+
try {
|
|
430
|
+
const result = await SecuremeSdk.start(WORKFLOW_DATA, smFlow, smConfig);
|
|
431
|
+
// handle success result
|
|
432
|
+
} catch (error: any) {
|
|
433
|
+
const msg = error && error.message ? error.message.toLowerCase() : '';
|
|
434
|
+
|
|
435
|
+
if (msg.includes('link') || msg.includes('linking')) {
|
|
436
|
+
// Native linking problems
|
|
437
|
+
Alert.alert(
|
|
438
|
+
'Linking Error',
|
|
439
|
+
'Native module not linked. Run pod install and rebuild.'
|
|
440
|
+
);
|
|
441
|
+
} else if (msg.includes('permission')) {
|
|
442
|
+
// Permission issues
|
|
443
|
+
Alert.alert(
|
|
444
|
+
'Permission Required',
|
|
445
|
+
'Please enable camera access in settings.'
|
|
446
|
+
);
|
|
447
|
+
} else if (msg.includes('session') || msg.includes('workflow')) {
|
|
448
|
+
// Session / workflow validation
|
|
449
|
+
Alert.alert(
|
|
450
|
+
'Session Error',
|
|
451
|
+
'Invalid workflow data or session init failed.'
|
|
452
|
+
);
|
|
453
|
+
} else if (msg.includes('network') || msg.includes('timeout')) {
|
|
454
|
+
// Network problems
|
|
455
|
+
Alert.alert(
|
|
456
|
+
'Network Error',
|
|
457
|
+
'Communication with the backend failed. Try again later.'
|
|
458
|
+
);
|
|
459
|
+
} else {
|
|
460
|
+
// Fallback
|
|
461
|
+
Alert.alert('Error', error?.message || 'Unknown error occurred');
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Notes:
|
|
467
|
+
|
|
468
|
+
- Native linking errors typically indicate native code not built/installed. For iOS, run `cd example/ios && pod install` and rebuild.
|
|
469
|
+
- PermissionError means the user denied camera access — prompt to open app settings.
|
|
470
|
+
- ValidationError indicates the provided WORKFLOW data is invalid JSON or missing required fields; validate before calling SDK.
|
|
471
|
+
- Log errors on the native side (Xcode / Logcat) for deeper diagnostics.
|
|
472
|
+
|
|
473
|
+
## License
|
|
474
|
+
|
|
475
|
+
MIT
|
|
476
|
+
|
|
477
|
+
## Support
|
|
478
|
+
|
|
479
|
+
For issues and questions, please visit [the repository issues page](https://example.com/repo/issues).
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['SecuremeSdk_kotlinVersion']
|
|
4
|
+
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath 'com.android.tools.build:gradle:8.2.2'
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
apply plugin: 'com.android.library'
|
|
18
|
+
apply plugin: 'kotlin-android'
|
|
19
|
+
|
|
20
|
+
def getExtOrDefault(name) {
|
|
21
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['SecuremeSdk_' + name]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
def getExtOrIntegerDefault(name) {
|
|
25
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['SecuremeSdk_' + name]).toInteger()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
android {
|
|
29
|
+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
30
|
+
buildToolsVersion getExtOrDefault('buildToolsVersion')
|
|
31
|
+
defaultConfig {
|
|
32
|
+
minSdkVersion 26
|
|
33
|
+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
34
|
+
versionCode 1
|
|
35
|
+
versionName "1.0.0"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
buildTypes {
|
|
39
|
+
release {
|
|
40
|
+
minifyEnabled false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
lintOptions {
|
|
44
|
+
disable 'GradleCompatible'
|
|
45
|
+
}
|
|
46
|
+
compileOptions {
|
|
47
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
48
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
repositories {
|
|
53
|
+
mavenCentral()
|
|
54
|
+
mavenLocal()
|
|
55
|
+
google()
|
|
56
|
+
|
|
57
|
+
def found = false
|
|
58
|
+
def defaultDir = null
|
|
59
|
+
def androidSourcesName = 'React Native sources'
|
|
60
|
+
|
|
61
|
+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
62
|
+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
63
|
+
} else {
|
|
64
|
+
defaultDir = new File(
|
|
65
|
+
projectDir,
|
|
66
|
+
'/../../../node_modules/react-native/android'
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (defaultDir.exists()) {
|
|
71
|
+
maven {
|
|
72
|
+
url defaultDir.toString()
|
|
73
|
+
name androidSourcesName
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
77
|
+
found = true
|
|
78
|
+
} else {
|
|
79
|
+
def parentDir = rootProject.projectDir
|
|
80
|
+
|
|
81
|
+
1.upto(5, {
|
|
82
|
+
if (found) return true
|
|
83
|
+
parentDir = parentDir.parentFile
|
|
84
|
+
|
|
85
|
+
def androidSourcesDir = new File(
|
|
86
|
+
parentDir,
|
|
87
|
+
'node_modules/react-native'
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
def androidPrebuiltBinaryDir = new File(
|
|
91
|
+
parentDir,
|
|
92
|
+
'node_modules/react-native/android'
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
if (androidPrebuiltBinaryDir.exists()) {
|
|
96
|
+
maven {
|
|
97
|
+
url androidPrebuiltBinaryDir.toString()
|
|
98
|
+
name androidSourcesName
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
102
|
+
found = true
|
|
103
|
+
} else if (androidSourcesDir.exists()) {
|
|
104
|
+
maven {
|
|
105
|
+
url androidSourcesDir.toString()
|
|
106
|
+
name androidSourcesName
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
110
|
+
found = true
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!found) {
|
|
116
|
+
throw new GradleException(
|
|
117
|
+
"${project.name}: unable to locate React Native android sources. " +
|
|
118
|
+
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
124
|
+
def camerax_version = "1.3.4"
|
|
125
|
+
def au10Version = '4.7.0'
|
|
126
|
+
|
|
127
|
+
dependencies {
|
|
128
|
+
// noinspection GradleDynamicVersion
|
|
129
|
+
api 'com.facebook.react:react-native:+'
|
|
130
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
131
|
+
|
|
132
|
+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
133
|
+
implementation "com.google.android.material:material:1.11.0"
|
|
134
|
+
|
|
135
|
+
//ML
|
|
136
|
+
implementation 'com.google.android.gms:play-services-mlkit-face-detection:17.1.0'
|
|
137
|
+
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:19.0.1'
|
|
138
|
+
|
|
139
|
+
// Camera
|
|
140
|
+
implementation "androidx.camera:camera-core:${camerax_version}"
|
|
141
|
+
implementation "androidx.camera:camera-camera2:${camerax_version}"
|
|
142
|
+
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
|
|
143
|
+
implementation "androidx.camera:camera-view:${camerax_version}"
|
|
144
|
+
implementation "androidx.camera:camera-extensions:${camerax_version}"
|
|
145
|
+
|
|
146
|
+
//Local SDC tflite dependencies
|
|
147
|
+
implementation 'com.google.android.gms:play-services-tflite-java:16.4.0'
|
|
148
|
+
implementation 'com.google.android.gms:play-services-tflite-support:16.4.0'
|
|
149
|
+
|
|
150
|
+
// Au10tix
|
|
151
|
+
implementation "com.au10tix.sdk:passive-face-liveness:$au10Version"
|
|
152
|
+
implementation "com.au10tix.sdk:smart-document:$au10Version"
|
|
153
|
+
implementation "com.au10tix.sdk:au10tix:$au10Version"
|
|
154
|
+
implementation "com.au10tix.sdk:local-infer:$au10Version"
|
|
155
|
+
implementation "com.au10tix.sdk:secure-me:$au10Version"
|
|
156
|
+
}
|