@kernaq/verify-react-native 1.0.2 → 1.0.3
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 +182 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# @kernaq/verify-react-native
|
|
2
|
+
|
|
3
|
+
Official React Native SDK for [Kernaq Identity](https://kernaq.com) — a drop-in KYC verification component that handles document capture, selfie, and liveness detection in a single modal. Works with both bare React Native and Expo.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @kernaq/verify-react-native react-native-vision-camera react-native-permissions
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Bare React Native — link native modules:**
|
|
12
|
+
```bash
|
|
13
|
+
cd ios && pod install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Expo — generate native folders:**
|
|
17
|
+
```bash
|
|
18
|
+
npx expo install @kernaq/verify-react-native react-native-vision-camera react-native-permissions
|
|
19
|
+
npx expo prebuild
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Android permissions
|
|
23
|
+
|
|
24
|
+
Add to `android/app/src/main/AndroidManifest.xml`:
|
|
25
|
+
```xml
|
|
26
|
+
<uses-permission android:name="android.permission.CAMERA" />
|
|
27
|
+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### iOS permissions
|
|
31
|
+
|
|
32
|
+
Add to `ios/<App>/Info.plist`:
|
|
33
|
+
```xml
|
|
34
|
+
<key>NSCameraUsageDescription</key>
|
|
35
|
+
<string>Camera is required to capture your ID document and selfie.</string>
|
|
36
|
+
<key>NSMicrophoneUsageDescription</key>
|
|
37
|
+
<string>Microphone is required to record the liveness video.</string>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import React, { useState } from 'react'
|
|
44
|
+
import { Button, View } from 'react-native'
|
|
45
|
+
import { KernaqVerify } from '@kernaq/verify-react-native'
|
|
46
|
+
|
|
47
|
+
export default function App() {
|
|
48
|
+
const [visible, setVisible] = useState(false)
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<View>
|
|
52
|
+
<Button title="Verify Identity" onPress={() => setVisible(true)} />
|
|
53
|
+
|
|
54
|
+
<KernaqVerify
|
|
55
|
+
visible={visible}
|
|
56
|
+
apiKey="k_test_..."
|
|
57
|
+
country="KEN"
|
|
58
|
+
reference="user_abc123"
|
|
59
|
+
onComplete={(result) => {
|
|
60
|
+
console.log(result.verdict) // "pass" | "fail" | "review"
|
|
61
|
+
console.log(result.score) // 0-100
|
|
62
|
+
console.log(result.faceMatch) // true | false
|
|
63
|
+
console.log(result.documentFields) // { name, dob, document_number, ... }
|
|
64
|
+
setVisible(false)
|
|
65
|
+
}}
|
|
66
|
+
onCancel={() => setVisible(false)}
|
|
67
|
+
onError={(err) => console.error(err.code, err.message)}
|
|
68
|
+
/>
|
|
69
|
+
</View>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Props
|
|
75
|
+
|
|
76
|
+
| Prop | Type | Required | Description |
|
|
77
|
+
|---|---|---|---|
|
|
78
|
+
| `visible` | `boolean` | ✓ | Show or hide the verification modal |
|
|
79
|
+
| `apiKey` | `string` | * | Your Kernaq API key (`k_test_...` or `k_live_...`) |
|
|
80
|
+
| `backendUrl` | `string` | * | Backend proxy URL (use instead of `apiKey` for production) |
|
|
81
|
+
| `country` | `string` | | ISO 3166-1 alpha-3 country code. Default: `KEN` |
|
|
82
|
+
| `reference` | `string` | | Your internal user/session ID |
|
|
83
|
+
| `sandbox` | `boolean` | | Use sandbox mode — no billing. Default: `false` |
|
|
84
|
+
| `livenessDuration` | `number` | | Liveness recording duration in ms. Default: `3000` |
|
|
85
|
+
| `documentTypes` | `DocumentType[]` | | Document types to accept. Default: `['national_id', 'passport']` |
|
|
86
|
+
| `theme` | `VerifyTheme` | | Customise colours, border radius and font |
|
|
87
|
+
| `locale` | `Partial<VerifyLocale>` | | Override any displayed string |
|
|
88
|
+
| `onComplete` | `(result: VerifyResult) => void` | | Called when verification completes |
|
|
89
|
+
| `onCancel` | `() => void` | | Called when user dismisses without completing |
|
|
90
|
+
| `onError` | `(error) => void` | | Called on unrecoverable error |
|
|
91
|
+
|
|
92
|
+
*Either `apiKey` or `backendUrl` is required.
|
|
93
|
+
|
|
94
|
+
## Theming
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
<KernaqVerify
|
|
98
|
+
visible={visible}
|
|
99
|
+
apiKey="k_test_..."
|
|
100
|
+
theme={{
|
|
101
|
+
accentColor: '#6366f1',
|
|
102
|
+
backgroundColor: '#0f0f0f',
|
|
103
|
+
textColor: '#f9fafb',
|
|
104
|
+
mode: 'dark',
|
|
105
|
+
borderRadius: 16,
|
|
106
|
+
}}
|
|
107
|
+
onComplete={handleComplete}
|
|
108
|
+
onCancel={() => setVisible(false)}
|
|
109
|
+
/>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Localisation
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
<KernaqVerify
|
|
116
|
+
visible={visible}
|
|
117
|
+
apiKey="k_test_..."
|
|
118
|
+
locale={{
|
|
119
|
+
intro_title: 'Thibitisha utambulisho wako',
|
|
120
|
+
intro_cta: 'Anza',
|
|
121
|
+
result_pass_title: 'Umefaulu',
|
|
122
|
+
}}
|
|
123
|
+
onComplete={handleComplete}
|
|
124
|
+
onCancel={() => setVisible(false)}
|
|
125
|
+
/>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Using a backend proxy (recommended for production)
|
|
129
|
+
|
|
130
|
+
Never expose a live API key in your app. Instead, forward requests through your server:
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
<KernaqVerify
|
|
134
|
+
visible={visible}
|
|
135
|
+
backendUrl="https://api.yourapp.com/kyc/verify"
|
|
136
|
+
country="KEN"
|
|
137
|
+
reference={userId}
|
|
138
|
+
onComplete={handleComplete}
|
|
139
|
+
onCancel={() => setVisible(false)}
|
|
140
|
+
/>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Your backend endpoint receives a `multipart/form-data` POST with `document`, `selfie`, `video`, `document_type`, `country`, and `reference` fields. Forward it to `https://api.identity.kernaq.com/v1/verify` with your secret key.
|
|
144
|
+
|
|
145
|
+
## Result object
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
interface VerifyResult {
|
|
149
|
+
verificationId: string
|
|
150
|
+
reference: string
|
|
151
|
+
verdict: 'pass' | 'fail' | 'review'
|
|
152
|
+
score: number // 0–100
|
|
153
|
+
faceMatch: boolean
|
|
154
|
+
isLive: boolean
|
|
155
|
+
documentFields?: {
|
|
156
|
+
name?: string
|
|
157
|
+
first_name?: string
|
|
158
|
+
last_name?: string
|
|
159
|
+
date_of_birth?: string
|
|
160
|
+
document_number?: string
|
|
161
|
+
nationality?: string
|
|
162
|
+
gender?: string
|
|
163
|
+
expiry_date?: string
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Peer dependencies
|
|
169
|
+
|
|
170
|
+
| Package | Version |
|
|
171
|
+
|---|---|
|
|
172
|
+
| `react` | `>=18.0.0` |
|
|
173
|
+
| `react-native` | `>=0.73.0` |
|
|
174
|
+
| `react-native-vision-camera` | `>=4.0.0` |
|
|
175
|
+
| `react-native-permissions` | `>=4.0.0` |
|
|
176
|
+
|
|
177
|
+
## Links
|
|
178
|
+
|
|
179
|
+
- [Documentation](https://kernaq.com/docs)
|
|
180
|
+
- [API Reference](https://kernaq.com/docs/api)
|
|
181
|
+
- [Dashboard](https://kernaq.com/dashboard)
|
|
182
|
+
- [GitHub](https://github.com/Kernaq/SDKs)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernaq/verify-react-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Drop-in KYC verification UI for React Native — document capture, selfie, and liveness in one component.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|