@kernaq/verify-react-native 1.0.2 → 1.0.4

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.
Files changed (2) hide show
  1. package/README.md +201 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,201 @@
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
+ ### Android — vision-camera setup
31
+
32
+ Add to `android/app/build.gradle`:
33
+ ```gradle
34
+ android {
35
+ ...
36
+ defaultConfig {
37
+ ...
38
+ minSdkVersion 26
39
+ }
40
+ }
41
+ ```
42
+
43
+ ### iOS — link native modules
44
+
45
+ ```bash
46
+ cd ios && pod install
47
+ ```
48
+
49
+ ### iOS permissions
50
+
51
+ Add to `ios/<App>/Info.plist`:
52
+ ```xml
53
+ <key>NSCameraUsageDescription</key>
54
+ <string>Camera is required to capture your ID document and selfie.</string>
55
+ <key>NSMicrophoneUsageDescription</key>
56
+ <string>Microphone is required to record the liveness video.</string>
57
+ ```
58
+
59
+ ## Quick start
60
+
61
+ ```tsx
62
+ import React, { useState } from 'react'
63
+ import { Button, View } from 'react-native'
64
+ import { KernaqVerify } from '@kernaq/verify-react-native'
65
+
66
+ export default function App() {
67
+ const [visible, setVisible] = useState(false)
68
+
69
+ return (
70
+ <View>
71
+ <Button title="Verify Identity" onPress={() => setVisible(true)} />
72
+
73
+ <KernaqVerify
74
+ visible={visible}
75
+ apiKey="k_test_..."
76
+ country="KEN"
77
+ reference="user_abc123"
78
+ onComplete={(result) => {
79
+ console.log(result.verdict) // "pass" | "fail" | "review"
80
+ console.log(result.score) // 0-100
81
+ console.log(result.faceMatch) // true | false
82
+ console.log(result.documentFields) // { name, dob, document_number, ... }
83
+ setVisible(false)
84
+ }}
85
+ onCancel={() => setVisible(false)}
86
+ onError={(err) => console.error(err.code, err.message)}
87
+ />
88
+ </View>
89
+ )
90
+ }
91
+ ```
92
+
93
+ ## Props
94
+
95
+ | Prop | Type | Required | Description |
96
+ |---|---|---|---|
97
+ | `visible` | `boolean` | ✓ | Show or hide the verification modal |
98
+ | `apiKey` | `string` | * | Your Kernaq API key (`k_test_...` or `k_live_...`) |
99
+ | `backendUrl` | `string` | * | Backend proxy URL (use instead of `apiKey` for production) |
100
+ | `country` | `string` | | ISO 3166-1 alpha-3 country code. Default: `KEN` |
101
+ | `reference` | `string` | | Your internal user/session ID |
102
+ | `sandbox` | `boolean` | | Use sandbox mode — no billing. Default: `false` |
103
+ | `livenessDuration` | `number` | | Liveness recording duration in ms. Default: `3000` |
104
+ | `documentTypes` | `DocumentType[]` | | Document types to accept. Default: `['national_id', 'passport']` |
105
+ | `theme` | `VerifyTheme` | | Customise colours, border radius and font |
106
+ | `locale` | `Partial<VerifyLocale>` | | Override any displayed string |
107
+ | `onComplete` | `(result: VerifyResult) => void` | | Called when verification completes |
108
+ | `onCancel` | `() => void` | | Called when user dismisses without completing |
109
+ | `onError` | `(error) => void` | | Called on unrecoverable error |
110
+
111
+ *Either `apiKey` or `backendUrl` is required.
112
+
113
+ ## Theming
114
+
115
+ ```tsx
116
+ <KernaqVerify
117
+ visible={visible}
118
+ apiKey="k_test_..."
119
+ theme={{
120
+ accentColor: '#6366f1',
121
+ backgroundColor: '#0f0f0f',
122
+ textColor: '#f9fafb',
123
+ mode: 'dark',
124
+ borderRadius: 16,
125
+ }}
126
+ onComplete={handleComplete}
127
+ onCancel={() => setVisible(false)}
128
+ />
129
+ ```
130
+
131
+ ## Localisation
132
+
133
+ ```tsx
134
+ <KernaqVerify
135
+ visible={visible}
136
+ apiKey="k_test_..."
137
+ locale={{
138
+ intro_title: 'Thibitisha utambulisho wako',
139
+ intro_cta: 'Anza',
140
+ result_pass_title: 'Umefaulu',
141
+ }}
142
+ onComplete={handleComplete}
143
+ onCancel={() => setVisible(false)}
144
+ />
145
+ ```
146
+
147
+ ## Using a backend proxy (recommended for production)
148
+
149
+ Never expose a live API key in your app. Instead, forward requests through your server:
150
+
151
+ ```tsx
152
+ <KernaqVerify
153
+ visible={visible}
154
+ backendUrl="https://api.yourapp.com/kyc/verify"
155
+ country="KEN"
156
+ reference={userId}
157
+ onComplete={handleComplete}
158
+ onCancel={() => setVisible(false)}
159
+ />
160
+ ```
161
+
162
+ 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.
163
+
164
+ ## Result object
165
+
166
+ ```ts
167
+ interface VerifyResult {
168
+ verificationId: string
169
+ reference: string
170
+ verdict: 'pass' | 'fail' | 'review'
171
+ score: number // 0–100
172
+ faceMatch: boolean
173
+ isLive: boolean
174
+ documentFields?: {
175
+ name?: string
176
+ first_name?: string
177
+ last_name?: string
178
+ date_of_birth?: string
179
+ document_number?: string
180
+ nationality?: string
181
+ gender?: string
182
+ expiry_date?: string
183
+ }
184
+ }
185
+ ```
186
+
187
+ ## Peer dependencies
188
+
189
+ | Package | Version |
190
+ |---|---|
191
+ | `react` | `>=18.0.0` |
192
+ | `react-native` | `>=0.73.0` |
193
+ | `react-native-vision-camera` | `>=4.0.0` |
194
+ | `react-native-permissions` | `>=4.0.0` |
195
+
196
+ ## Links
197
+
198
+ - [Documentation](https://kernaq.com/docs)
199
+ - [API Reference](https://kernaq.com/docs/api)
200
+ - [Dashboard](https://kernaq.com/dashboard)
201
+ - [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.2",
3
+ "version": "1.0.4",
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",