@kernaq/verify-react-native 2.0.0 → 2.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/README.md +1 -1
- package/dist/index.d.ts +95 -50
- package/dist/index.esm.js +1171 -580
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1169 -576
- package/dist/index.js.map +1 -1
- package/package.json +2 -9
- package/src/KernaqVerify.tsx +172 -176
- package/src/index.ts +9 -4
- package/src/locale.ts +32 -29
- package/src/quality.ts +180 -0
- package/src/steps/DocumentStep.tsx +214 -77
- package/src/steps/IntroStep.tsx +58 -37
- package/src/steps/LivenessStep.tsx +225 -125
- package/src/steps/ProcessingStep.tsx +10 -34
- package/src/steps/ResultStep.tsx +99 -35
- package/src/steps/SelfieStep.tsx +165 -96
- package/src/theme.ts +22 -14
- package/src/types.ts +27 -51
package/src/types.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @kernaq/verify-react-native — public types
|
|
2
|
+
* @kernaq/verify-react-native — public types (v2)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
export type VerifyStep =
|
|
6
6
|
| 'intro'
|
|
7
|
-
| '
|
|
7
|
+
| 'doc-front'
|
|
8
|
+
| 'doc-back'
|
|
8
9
|
| 'selfie'
|
|
9
10
|
| 'liveness'
|
|
10
11
|
| 'processing'
|
|
11
12
|
| 'result'
|
|
12
13
|
|
|
14
|
+
/** Which capture steps to include. Default: all three. */
|
|
15
|
+
export type VerifyStepName = 'document' | 'selfie' | 'liveness'
|
|
16
|
+
|
|
17
|
+
/** Liveness challenge tasks */
|
|
18
|
+
export type LivenessTask = 'blink' | 'turn-left' | 'turn-right' | 'nod' | 'open-mouth'
|
|
19
|
+
|
|
13
20
|
export type DocumentType =
|
|
14
21
|
| 'national_id'
|
|
15
22
|
| 'passport'
|
|
@@ -29,21 +36,14 @@ export interface VerifyResult {
|
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
export interface VerifyTheme {
|
|
32
|
-
/** Primary accent colour. Default: #111827 */
|
|
33
39
|
accentColor?: string
|
|
34
|
-
/** Modal background. Default: #ffffff */
|
|
35
40
|
backgroundColor?: string
|
|
36
|
-
/** Primary text colour. Default: #111827 */
|
|
37
41
|
textColor?: string
|
|
38
|
-
/** Subtle text colour. Default: #6b7280 */
|
|
39
42
|
subtextColor?: string
|
|
40
|
-
/** Border/divider colour. Default: #e5e7eb */
|
|
41
43
|
borderColor?: string
|
|
42
|
-
/** Card/surface colour. Default: #f9fafb */
|
|
43
44
|
cardColor?: string
|
|
44
|
-
/** Border radius for buttons and cards. Default: 12 */
|
|
45
45
|
borderRadius?: number
|
|
46
|
-
/** 'light' | 'dark'
|
|
46
|
+
/** 'light' | 'dark' */
|
|
47
47
|
mode?: 'light' | 'dark'
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -51,74 +51,50 @@ export interface VerifyLocale {
|
|
|
51
51
|
intro_title: string
|
|
52
52
|
intro_body: string
|
|
53
53
|
intro_cta: string
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
doc_front_title: string
|
|
55
|
+
doc_front_instruction: string
|
|
56
|
+
doc_back_title: string
|
|
57
|
+
doc_back_instruction: string
|
|
56
58
|
doc_capture_btn: string
|
|
57
59
|
doc_retake_btn: string
|
|
58
|
-
doc_next_btn: string
|
|
59
60
|
selfie_title: string
|
|
60
61
|
selfie_instruction: string
|
|
61
|
-
selfie_capture_btn: string
|
|
62
|
-
selfie_retake_btn: string
|
|
63
|
-
selfie_next_btn: string
|
|
64
62
|
liveness_title: string
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
liveness_ready: string
|
|
64
|
+
liveness_task_prefix: string
|
|
65
|
+
liveness_complete: string
|
|
68
66
|
processing_title: string
|
|
69
|
-
processing_subtitle: string
|
|
70
67
|
result_pass_title: string
|
|
71
68
|
result_pass_body: string
|
|
72
69
|
result_fail_title: string
|
|
73
70
|
result_fail_body: string
|
|
74
71
|
result_review_title: string
|
|
75
72
|
result_review_body: string
|
|
76
|
-
result_retry_btn: string
|
|
77
73
|
error_camera_denied: string
|
|
74
|
+
error_blur: string
|
|
78
75
|
error_quality: string
|
|
79
76
|
error_network: string
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
export interface VerifyConfig {
|
|
83
|
-
/**
|
|
84
|
-
* Your Kernaq publishable API key (k_test_... or k_live_...).
|
|
85
|
-
* For production use a backend proxy and pass backendUrl instead.
|
|
86
|
-
*/
|
|
87
80
|
apiKey?: string
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* URL of your backend proxy that forwards to the Kernaq Identity API.
|
|
91
|
-
* POST /verify with multipart/form-data.
|
|
92
|
-
*/
|
|
93
81
|
backendUrl?: string
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
documentTypes?: DocumentType[]
|
|
97
|
-
|
|
98
|
-
/** Country code (ISO 3166-1 alpha-3). Default: 'KEN' */
|
|
82
|
+
/** Single document type the developer specifies. Default: 'national_id' */
|
|
83
|
+
documentType?: DocumentType
|
|
99
84
|
country?: string
|
|
100
|
-
|
|
101
|
-
/** Your internal reference ID for this user/session */
|
|
102
85
|
reference?: string
|
|
103
|
-
|
|
104
|
-
/** Use sandbox mode — no billing, test responses */
|
|
105
86
|
sandbox?: boolean
|
|
106
|
-
|
|
107
|
-
/** Liveness recording duration in ms. Default: 3000 */
|
|
108
87
|
livenessDuration?: number
|
|
109
|
-
|
|
110
|
-
|
|
88
|
+
/** Number of liveness tasks. Default: 2 */
|
|
89
|
+
livenessTaskCount?: number
|
|
90
|
+
/**
|
|
91
|
+
* Which steps to include. Default: all three.
|
|
92
|
+
* @example steps={['selfie', 'liveness']}
|
|
93
|
+
*/
|
|
94
|
+
steps?: VerifyStepName[]
|
|
111
95
|
theme?: VerifyTheme
|
|
112
|
-
|
|
113
|
-
/** Override any displayed string */
|
|
114
96
|
locale?: Partial<VerifyLocale>
|
|
115
|
-
|
|
116
|
-
/** Called when the user dismisses without completing */
|
|
117
97
|
onCancel?: () => void
|
|
118
|
-
|
|
119
|
-
/** Called when verification is complete */
|
|
120
98
|
onComplete?: (result: VerifyResult) => void
|
|
121
|
-
|
|
122
|
-
/** Called on unrecoverable error */
|
|
123
99
|
onError?: (error: { code: string; message: string }) => void
|
|
124
100
|
}
|