@kernaq/verify-react-native 1.0.2
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/dist/index.d.ts +125 -0
- package/dist/index.esm.js +1198 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +1200 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
- package/src/KernaqVerify.tsx +329 -0
- package/src/hooks/useCamera.ts +73 -0
- package/src/hooks/usePermissions.ts +67 -0
- package/src/index.ts +32 -0
- package/src/locale.ts +33 -0
- package/src/steps/DocumentStep.tsx +141 -0
- package/src/steps/IntroStep.tsx +82 -0
- package/src/steps/LivenessStep.tsx +197 -0
- package/src/steps/ProcessingStep.tsx +66 -0
- package/src/steps/ResultStep.tsx +108 -0
- package/src/steps/SelfieStep.tsx +138 -0
- package/src/theme.ts +24 -0
- package/src/types.ts +124 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @kernaq/verify-react-native — public types
|
|
5
|
+
*/
|
|
6
|
+
type VerifyStep = 'intro' | 'document' | 'selfie' | 'liveness' | 'processing' | 'result';
|
|
7
|
+
type DocumentType = 'national_id' | 'passport' | 'driver_license' | 'alien_card';
|
|
8
|
+
type VerifyVerdict = 'pass' | 'fail' | 'review';
|
|
9
|
+
interface VerifyResult {
|
|
10
|
+
verificationId: string;
|
|
11
|
+
reference: string;
|
|
12
|
+
verdict: VerifyVerdict;
|
|
13
|
+
score: number;
|
|
14
|
+
faceMatch: boolean;
|
|
15
|
+
isLive: boolean;
|
|
16
|
+
documentFields?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
interface VerifyTheme {
|
|
19
|
+
/** Primary accent colour. Default: #111827 */
|
|
20
|
+
accentColor?: string;
|
|
21
|
+
/** Modal background. Default: #ffffff */
|
|
22
|
+
backgroundColor?: string;
|
|
23
|
+
/** Primary text colour. Default: #111827 */
|
|
24
|
+
textColor?: string;
|
|
25
|
+
/** Subtle text colour. Default: #6b7280 */
|
|
26
|
+
subtextColor?: string;
|
|
27
|
+
/** Border/divider colour. Default: #e5e7eb */
|
|
28
|
+
borderColor?: string;
|
|
29
|
+
/** Card/surface colour. Default: #f9fafb */
|
|
30
|
+
cardColor?: string;
|
|
31
|
+
/** Border radius for buttons and cards. Default: 12 */
|
|
32
|
+
borderRadius?: number;
|
|
33
|
+
/** 'light' | 'dark' — overrides bg/text when set */
|
|
34
|
+
mode?: 'light' | 'dark';
|
|
35
|
+
}
|
|
36
|
+
interface VerifyLocale {
|
|
37
|
+
intro_title: string;
|
|
38
|
+
intro_body: string;
|
|
39
|
+
intro_cta: string;
|
|
40
|
+
doc_title: string;
|
|
41
|
+
doc_instruction: string;
|
|
42
|
+
doc_capture_btn: string;
|
|
43
|
+
doc_retake_btn: string;
|
|
44
|
+
doc_next_btn: string;
|
|
45
|
+
selfie_title: string;
|
|
46
|
+
selfie_instruction: string;
|
|
47
|
+
selfie_capture_btn: string;
|
|
48
|
+
selfie_retake_btn: string;
|
|
49
|
+
selfie_next_btn: string;
|
|
50
|
+
liveness_title: string;
|
|
51
|
+
liveness_instruction: string;
|
|
52
|
+
liveness_start_btn: string;
|
|
53
|
+
liveness_recording: string;
|
|
54
|
+
processing_title: string;
|
|
55
|
+
processing_subtitle: string;
|
|
56
|
+
result_pass_title: string;
|
|
57
|
+
result_pass_body: string;
|
|
58
|
+
result_fail_title: string;
|
|
59
|
+
result_fail_body: string;
|
|
60
|
+
result_review_title: string;
|
|
61
|
+
result_review_body: string;
|
|
62
|
+
result_retry_btn: string;
|
|
63
|
+
error_camera_denied: string;
|
|
64
|
+
error_quality: string;
|
|
65
|
+
error_network: string;
|
|
66
|
+
}
|
|
67
|
+
interface VerifyConfig {
|
|
68
|
+
/**
|
|
69
|
+
* Your Kernaq publishable API key (k_test_... or k_live_...).
|
|
70
|
+
* For production use a backend proxy and pass backendUrl instead.
|
|
71
|
+
*/
|
|
72
|
+
apiKey?: string;
|
|
73
|
+
/**
|
|
74
|
+
* URL of your backend proxy that forwards to the Kernaq Identity API.
|
|
75
|
+
* POST /verify with multipart/form-data.
|
|
76
|
+
*/
|
|
77
|
+
backendUrl?: string;
|
|
78
|
+
/** Document types the user can select. Default: ['national_id', 'passport'] */
|
|
79
|
+
documentTypes?: DocumentType[];
|
|
80
|
+
/** Country code (ISO 3166-1 alpha-3). Default: 'KEN' */
|
|
81
|
+
country?: string;
|
|
82
|
+
/** Your internal reference ID for this user/session */
|
|
83
|
+
reference?: string;
|
|
84
|
+
/** Use sandbox mode — no billing, test responses */
|
|
85
|
+
sandbox?: boolean;
|
|
86
|
+
/** Liveness recording duration in ms. Default: 3000 */
|
|
87
|
+
livenessDuration?: number;
|
|
88
|
+
/** Theming */
|
|
89
|
+
theme?: VerifyTheme;
|
|
90
|
+
/** Override any displayed string */
|
|
91
|
+
locale?: Partial<VerifyLocale>;
|
|
92
|
+
/** Called when the user dismisses without completing */
|
|
93
|
+
onCancel?: () => void;
|
|
94
|
+
/** Called when verification is complete */
|
|
95
|
+
onComplete?: (result: VerifyResult) => void;
|
|
96
|
+
/** Called on unrecoverable error */
|
|
97
|
+
onError?: (error: {
|
|
98
|
+
code: string;
|
|
99
|
+
message: string;
|
|
100
|
+
}) => void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* <KernaqVerify /> — drop-in identity verification modal for React Native.
|
|
105
|
+
*
|
|
106
|
+
* Usage:
|
|
107
|
+
* import { KernaqVerify } from '@kernaq/verify-react-native'
|
|
108
|
+
*
|
|
109
|
+
* <KernaqVerify
|
|
110
|
+
* visible={showVerify}
|
|
111
|
+
* apiKey="k_test_..."
|
|
112
|
+
* country="KEN"
|
|
113
|
+
* reference={userId}
|
|
114
|
+
* onComplete={(result) => console.log(result.verdict)}
|
|
115
|
+
* onCancel={() => setShowVerify(false)}
|
|
116
|
+
* />
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
interface Props extends VerifyConfig {
|
|
120
|
+
visible: boolean;
|
|
121
|
+
}
|
|
122
|
+
declare function KernaqVerify({ visible, apiKey, backendUrl, country, reference, sandbox, livenessDuration, documentTypes, theme: themeProp, locale: localeProp, onCancel, onComplete, onError, }: Props): React.JSX.Element;
|
|
123
|
+
|
|
124
|
+
export { KernaqVerify };
|
|
125
|
+
export type { DocumentType, VerifyConfig, VerifyLocale, VerifyResult, VerifyStep, VerifyTheme, VerifyVerdict };
|