@sanctum-key/react-native-sdk 1.0.4 β 1.0.5
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 +148 -157
- package/build/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Sanctum Key KYC SDK
|
|
2
|
+
|
|
3
|
+
A comprehensive React Native SDK for identity verification (KYC β Know Your Customer) with Expo support, featuring advanced camera capabilities powered by `react-native-vision-camera`.
|
|
2
4
|
|
|
3
|
-
A comprehensive React Native SDK for identity verification (KYC - Know Your Customer) with Expo support, featuring advanced camera capabilities powered by react-native-vision-camera.
|
|
4
5
|
|
|
5
6
|
## π Features
|
|
6
7
|
|
|
@@ -20,17 +21,43 @@ A comprehensive React Native SDK for identity verification (KYC - Know Your Cust
|
|
|
20
21
|
β
**Country Selection** with region mapping
|
|
21
22
|
β
**Reusable UI Components**
|
|
22
23
|
|
|
23
|
-
##
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
To avoid version conflicts, install the SDK and its peer dependencies in three distinct steps.
|
|
27
|
+
|
|
28
|
+
### Prerequisites
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
Initialize a new Expo project with TypeScript (recommended):
|
|
26
31
|
|
|
27
32
|
```bash
|
|
28
|
-
|
|
33
|
+
npx create-expo-app@latest my-kyc-app --template blank-typescript
|
|
34
|
+
cd my-kyc-app
|
|
29
35
|
```
|
|
30
36
|
|
|
31
|
-
###
|
|
37
|
+
### Step 1 β Install the SDK
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
```bash
|
|
40
|
+
npm install @sanctum-key/react-native-sdk --legacy-peer-deps
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Step 2 β Install Native Expo Dependencies
|
|
44
|
+
|
|
45
|
+
Use `npx expo install` so Expo automatically resolves the correct versions for your SDK build (e.g., SDK 53 or 54):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx expo install react-native-vision-camera expo-location expo-image-manipulator react-native-svg
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Step 3 β Install Standard NPM Dependencies
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install axios i18n-js iconsax-react-nativejs zustand
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## Expo Configuration
|
|
59
|
+
|
|
60
|
+
Because this SDK uses the camera and location, add the plugin to your `app.json` (or `app.config.js`) to automatically inject the correct native permissions for iOS and Android.
|
|
34
61
|
|
|
35
62
|
```json
|
|
36
63
|
{
|
|
@@ -52,8 +79,8 @@ Add the plugin to your Expo configuration file:
|
|
|
52
79
|
"microphonePermissionText": "This app uses the microphone for video recording."
|
|
53
80
|
},
|
|
54
81
|
"location": {
|
|
55
|
-
"locationPermissionText": "This app uses location to verify your identity
|
|
56
|
-
"locationWhenInUsePermissionText": "This app uses location to verify your identity
|
|
82
|
+
"locationPermissionText": "This app uses location to verify your identity.",
|
|
83
|
+
"locationWhenInUsePermissionText": "This app uses location to verify your identity.",
|
|
57
84
|
"enableBackgroundLocation": false
|
|
58
85
|
}
|
|
59
86
|
}
|
|
@@ -63,216 +90,180 @@ Add the plugin to your Expo configuration file:
|
|
|
63
90
|
}
|
|
64
91
|
```
|
|
65
92
|
|
|
66
|
-
|
|
93
|
+
> **Important:** After updating your `app.json`, you must generate a new native build (`eas build --profile development` or `npx expo prebuild`) for the permissions to take effect.
|
|
67
94
|
|
|
68
|
-
|
|
95
|
+
### Building the App for Development
|
|
69
96
|
|
|
70
|
-
|
|
97
|
+
Since this SDK requires custom native code (camera and location permissions), you cannot use Expo Go. You must create a development build using Expo Application Services (EAS).
|
|
71
98
|
|
|
72
|
-
|
|
99
|
+
1. Install the EAS CLI:
|
|
73
100
|
|
|
74
|
-
|
|
101
|
+
```bash
|
|
102
|
+
npm install -g eas-cli
|
|
103
|
+
```
|
|
75
104
|
|
|
76
|
-
|
|
105
|
+
2. Log in and configure the build:
|
|
77
106
|
|
|
78
|
-
|
|
107
|
+
```bash
|
|
108
|
+
eas login
|
|
109
|
+
eas build:configure
|
|
110
|
+
```
|
|
79
111
|
|
|
80
|
-
|
|
81
|
-
import React from 'react';
|
|
82
|
-
import { LaunchTransferGratisKYC } from '@sanctumkey/react-native-sdk';
|
|
112
|
+
3. Run the build (select the `development` profile):
|
|
83
113
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Alert.alert('Template KYC completed');
|
|
89
|
-
setShowTemplateKYC(false);
|
|
90
|
-
console.log('Template KYC completed', JSON.stringify(data, null, 2));
|
|
91
|
-
}}
|
|
92
|
-
onCancel={() => {
|
|
93
|
-
setShowTemplateKYC(false);
|
|
94
|
-
Alert.alert('Template KYC cancelled');
|
|
95
|
-
}}
|
|
96
|
-
onError={(error) => {
|
|
97
|
-
Alert.alert('Template KYC error', error);
|
|
98
|
-
setShowTemplateKYC(false);
|
|
99
|
-
}}
|
|
100
|
-
language="en"
|
|
101
|
-
API_KEY={undefined} // for test env leave this blanc
|
|
102
|
-
/>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
```
|
|
114
|
+
```bash
|
|
115
|
+
eas build --profile development --platform android
|
|
116
|
+
# or --platform ios
|
|
117
|
+
```
|
|
106
118
|
|
|
119
|
+
4. Once the build finishes, install the app on your device or emulator and start the local development server:
|
|
107
120
|
|
|
108
|
-
|
|
121
|
+
```bash
|
|
122
|
+
npx expo start --dev-client
|
|
123
|
+
```
|
|
109
124
|
|
|
110
|
-
### Building the SDK
|
|
111
125
|
|
|
112
|
-
|
|
113
|
-
cd transfergratis-sdk
|
|
114
|
-
npm install
|
|
115
|
-
npm run build
|
|
116
|
-
```
|
|
126
|
+
## Quick Start
|
|
117
127
|
|
|
118
|
-
|
|
128
|
+
The recommended approach is to use the JSON template system to configure your KYC flow. Drop this into your `App.tsx`:
|
|
119
129
|
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
```
|
|
130
|
+
```tsx
|
|
131
|
+
import React, { useState } from 'react';
|
|
132
|
+
import { Alert, View, StyleSheet } from 'react-native';
|
|
133
|
+
import { LaunchTransferGratisKYC, VerificationState } from '@sanctum-key/react-native-sdk';
|
|
125
134
|
|
|
126
|
-
|
|
135
|
+
export default function App() {
|
|
136
|
+
const [showKYC, setShowKYC] = useState(true);
|
|
127
137
|
|
|
128
|
-
|
|
129
|
-
npm test
|
|
130
|
-
```
|
|
138
|
+
if (!showKYC) return <View style={styles.container} />;
|
|
131
139
|
|
|
132
|
-
|
|
140
|
+
return (
|
|
141
|
+
<View style={styles.container}>
|
|
142
|
+
<LaunchTransferGratisKYC
|
|
143
|
+
onComplete={(data: VerificationState) => {
|
|
144
|
+
Alert.alert('Success', 'KYC Verification Completed');
|
|
145
|
+
setShowKYC(false);
|
|
146
|
+
console.log('KYC Data:', JSON.stringify(data, null, 2));
|
|
147
|
+
}}
|
|
148
|
+
onCancel={() => {
|
|
149
|
+
Alert.alert('Cancelled', 'User exited the KYC flow');
|
|
150
|
+
setShowKYC(false);
|
|
151
|
+
}}
|
|
152
|
+
onError={(error) => {
|
|
153
|
+
Alert.alert('Error', String(error));
|
|
154
|
+
setShowKYC(false);
|
|
155
|
+
}}
|
|
156
|
+
language="en"
|
|
157
|
+
API_KEY={undefined} // Leave undefined for test environments
|
|
158
|
+
env="PRODUCTION"
|
|
159
|
+
/>
|
|
160
|
+
</View>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
133
163
|
|
|
134
|
-
|
|
135
|
-
|
|
164
|
+
const styles = StyleSheet.create({
|
|
165
|
+
container: {
|
|
166
|
+
flex: 1,
|
|
167
|
+
},
|
|
168
|
+
});
|
|
136
169
|
```
|
|
137
170
|
|
|
138
|
-
## π npm Publishing
|
|
139
171
|
|
|
140
|
-
|
|
172
|
+
## Supported Document Types
|
|
141
173
|
|
|
142
|
-
|
|
143
|
-
|
|
174
|
+
| Key | Description |
|
|
175
|
+
|---|---|
|
|
176
|
+
| `identity_card` | Identity card |
|
|
177
|
+
| `passport` | Passport |
|
|
178
|
+
| `drivers_licence` | Driver's license |
|
|
179
|
+
| `health_insurance_card` | Health insurance card |
|
|
180
|
+
| `permanent_residence` | Permanent residence permit |
|
|
181
|
+
| `national_id` | National ID card |
|
|
182
|
+
| `work_permit` | Work permit |
|
|
144
183
|
|
|
145
|
-
### Release Steps
|
|
146
184
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
cd transfergratis-sdk
|
|
151
|
-
npm ci
|
|
152
|
-
npm run clean
|
|
153
|
-
```
|
|
185
|
+
## Multilingual Support
|
|
154
186
|
|
|
155
|
-
|
|
187
|
+
The SDK currently supports **French** and **English**. Texts can be customized via the JSON template system using `LocalizedText` objects:
|
|
156
188
|
|
|
157
|
-
```
|
|
158
|
-
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"labels": {
|
|
192
|
+
"en": "Upload your ID card",
|
|
193
|
+
"fr": "TΓ©lΓ©versez votre carte d'identitΓ©"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
159
196
|
```
|
|
160
197
|
|
|
161
|
-
3. **Verify content to be published**
|
|
162
198
|
|
|
163
|
-
|
|
164
|
-
npm publish --dry-run
|
|
165
|
-
npm pack
|
|
166
|
-
tar -tf transfergratis-react-native-sdk-*.tgz | cat
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
4. **Bump version**
|
|
199
|
+
## Troubleshooting
|
|
170
200
|
|
|
201
|
+
**`Unable to resolve "@sanctum-key/react-native-sdk"`**
|
|
202
|
+
Metro has cached an old build. Stop your server and run:
|
|
171
203
|
```bash
|
|
172
|
-
|
|
173
|
-
npm version patch -m "release: %s"
|
|
204
|
+
npx expo start --clear
|
|
174
205
|
```
|
|
175
206
|
|
|
176
|
-
|
|
207
|
+
**`Unable to resolve "react-native-svg"` / `"expo-image-manipulator"`**
|
|
208
|
+
You are missing a peer dependency. Re-run the installation commands in Steps 2 and 3, then clear your Metro cache.
|
|
177
209
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
```
|
|
210
|
+
**Camera or location crashes on launch**
|
|
211
|
+
You likely haven't rebuilt your native app since adding the plugin to `app.json`. Run an EAS build to inject the permissions into your `AndroidManifest.xml` and `Info.plist`.
|
|
181
212
|
|
|
182
|
-
6. **Publish to npm (public)**
|
|
183
213
|
|
|
184
|
-
|
|
185
|
-
npm publish --access public
|
|
186
|
-
```
|
|
214
|
+
## Development & Publishing
|
|
187
215
|
|
|
188
|
-
|
|
216
|
+
> This section is intended for SDK maintainers.
|
|
189
217
|
|
|
190
|
-
|
|
191
|
-
npm publish --access public --otp=123456
|
|
192
|
-
```
|
|
218
|
+
### Building Locally
|
|
193
219
|
|
|
194
|
-
|
|
220
|
+
When modifying the SDK, ensure all static assets (`.gif`, `.svg`) are correctly copied to the build folder:
|
|
195
221
|
|
|
196
222
|
```bash
|
|
197
|
-
npm
|
|
223
|
+
npm install
|
|
224
|
+
npm run build
|
|
198
225
|
```
|
|
199
226
|
|
|
200
|
-
|
|
227
|
+
### Publishing to NPM
|
|
228
|
+
|
|
229
|
+
Clean and build a fresh copy:
|
|
201
230
|
|
|
202
231
|
```bash
|
|
203
|
-
|
|
232
|
+
npm ci
|
|
233
|
+
npm run clean
|
|
234
|
+
npm run build
|
|
204
235
|
```
|
|
205
236
|
|
|
206
|
-
|
|
237
|
+
Bump the version:
|
|
207
238
|
|
|
208
239
|
```bash
|
|
209
|
-
|
|
240
|
+
# Choose one: patch | minor | major
|
|
241
|
+
npm version patch -m "release: %s"
|
|
210
242
|
```
|
|
211
243
|
|
|
212
|
-
|
|
244
|
+
Publish to the public registry:
|
|
213
245
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
- `identity_card` - Identity card
|
|
217
|
-
- `passport` - Passport
|
|
218
|
-
- `drivers_licence` - Driver's license
|
|
219
|
-
- `health_insurance_card` - Health insurance card
|
|
220
|
-
- `permanent_residence` - Permanent residence permit
|
|
221
|
-
- `national_id` - National ID card
|
|
222
|
-
- `work_permit` - Work permit
|
|
223
|
-
|
|
224
|
-
## π Multilingual Support
|
|
225
|
-
|
|
226
|
-
The SDK currently supports French and English. Texts can be customized via the JSON template system using `LocalizedText` objects:
|
|
227
|
-
|
|
228
|
-
```tsx
|
|
229
|
-
{
|
|
230
|
-
labels: {
|
|
231
|
-
en: "Upload your ID card",
|
|
232
|
-
fr: "TΓ©lΓ©versez votre carte d'identitΓ©"
|
|
233
|
-
}
|
|
234
|
-
}
|
|
246
|
+
```bash
|
|
247
|
+
npm publish --access public
|
|
235
248
|
```
|
|
236
249
|
|
|
237
|
-
##
|
|
238
|
-
|
|
239
|
-
### v0.1.10
|
|
240
|
-
|
|
241
|
-
- **JSON Template System**: New JSON-based configuration system
|
|
242
|
-
- **Specialized KYC Components**: New components for each KYC flow step
|
|
243
|
-
- **Web Support**: Added support for web applications
|
|
244
|
-
- **Liveness Detection Improvements**: Enhanced orientation video processing
|
|
245
|
-
- **Multilingual Support**: Improved support for multiple languages
|
|
246
|
-
|
|
247
|
-
### v0.1.0
|
|
248
|
-
|
|
249
|
-
- **Camera Implementation**: Switched from custom native views to react-native-vision-camera
|
|
250
|
-
- **Permissions**: Now requires both camera and microphone permissions
|
|
251
|
-
- **Component Props**: Updated prop interfaces for better type safety
|
|
252
|
-
- **Config Plugin**: New plugin required for automatic permissions setup
|
|
253
|
-
|
|
254
|
-
## π€ Contributing
|
|
250
|
+
## Contributing
|
|
255
251
|
|
|
256
252
|
1. Fork the repository
|
|
257
|
-
2. Create your feature branch
|
|
258
|
-
3. Commit your changes
|
|
259
|
-
4. Push to the branch
|
|
253
|
+
2. Create your feature branch: `git checkout -b feature/amazing-feature`
|
|
254
|
+
3. Commit your changes: `git commit -m 'Add some amazing feature'`
|
|
255
|
+
4. Push to the branch: `git push origin feature/amazing-feature`
|
|
260
256
|
5. Open a Pull Request
|
|
261
257
|
|
|
262
|
-
## π License
|
|
263
258
|
|
|
264
|
-
|
|
259
|
+
## License
|
|
265
260
|
|
|
266
|
-
|
|
261
|
+
This project is licensed under the **MIT License** β see the [LICENSE](./LICENSE) file for details.
|
|
267
262
|
|
|
268
|
-
For support, email support@transfergratis.com or open an issue on GitHub.
|
|
269
263
|
|
|
270
|
-
##
|
|
264
|
+
## Support
|
|
271
265
|
|
|
272
|
-
|
|
273
|
-
- [Expo Documentation](https://docs.expo.dev/)
|
|
274
|
-
- [GitHub Repository](https://github.com/TransfergratisOrg/KYC-User-Frontend)
|
|
266
|
+
For support, email [support@transfergratis.com](mailto:support@sanctumkey.com) or open an issue on GitHub.
|
|
275
267
|
|
|
276
|
-
---
|
|
277
268
|
|
|
278
|
-
Built with β€οΈ by the
|
|
269
|
+
Built with β€οΈ by the [Sanctum Key](https://service.sanctumkey.com) Team
|
package/build/package.json
CHANGED