@richard.fadiora/liveness-detection 3.0.3 → 3.1.0

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 CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  A React-based liveness detection component that performs randomized user challenges and verifies real-user presence via a backend anti-spoofing API.
4
4
 
5
- This version introduces **headless mode**, **render-prop customization**, and robust **challenge sequencing**, allowing you to fully control the UI while keeping the verification logic encapsulated.
5
+ This version introduces **headless mode**, **render-prop customization**, and robust **challenge sequencing**, **configurable thresholds** for `Smile`, `Blink`, and `Turn_Head` challenges
6
+
7
+ Pause between steps for user feedback
8
+
9
+ Sequential challenge execution with strict timeout handling allowing you to fully control the UI while keeping the verification logic encapsulated.
6
10
 
7
11
  ---
8
12
 
@@ -14,7 +18,8 @@ This component strengthens identity verification by combining:
14
18
  - Strict timeout enforcement
15
19
  - Backend spoof detection
16
20
  - Callback-based integration for easy usage
17
- - Headless / fully customizable UI via render props
21
+ - Headless / fully customizable UI via render props
22
+ - Configurable challenge thresholds to adapt difficulty
18
23
 
19
24
  It protects against:
20
25
 
@@ -38,6 +43,14 @@ It protects against:
38
43
  - Real-time validation using webcam input and MediaPipe models.
39
44
  - Sequential verification ensures **no steps are skipped**.
40
45
  - Developers can render custom UI via the **render prop** while using the same underlying logic.
46
+ - Challenge thresholds are configurable through props:
47
+
48
+ | Prop Name | Default | Description |
49
+ |-----------------------|---------|------------------------------------------|
50
+ | `smileThreshold` | 0.20 | Minimum smile width to count as valid |
51
+ | `blinkThreshold` | 0.01 | Maximum eye aspect ratio to count as blink |
52
+ | `minturnHeadThreshold`| 0.15 | Minimum yaw for right head turn detection |
53
+ | `maxturnHeadThreshold`| 0.85 | Maximum yaw for left head turn detection |
41
54
 
42
55
  ### 3️⃣ Backend Liveness Verification
43
56
 
@@ -76,6 +89,11 @@ onError({ success: false, reason, skinConfidence: null });
76
89
  | `duration` | `number` | No | Maximum time for all challenges (default: 60s) |
77
90
  | `render` | `(sdk: object) => JSX.Element` | No | Optional render prop for full UI customization |
78
91
  | `classNames` | `object` | No | Optional CSS class names to customize default UI |
92
+ | `smileThreshold` | `number` | No | Minimum smile width for Smile challenge |
93
+ | `blinkThreshold` | `number` | No | Maximum eye aspect ratio for Blink challenge |
94
+ | `minturnHeadThreshold` | `number` | No | Minimum yaw for Turn_Head challenge |
95
+ | `maxturnHeadThreshold` | `number` | No | Maximum yaw for Turn_Head challenge |
96
+
79
97
 
80
98
  ---
81
99
 
@@ -126,6 +144,7 @@ classNames={{
126
144
  container: "liveness-container",
127
145
  webcam: "liveness-webcam",
128
146
  button: "liveness-button",
147
+ challenge: "liveness-challenge",
129
148
  timer: "liveness-timer",
130
149
  error: "liveness-error",
131
150
  success: "liveness-success",
@@ -158,6 +177,11 @@ classNames={{
158
177
  cursor: pointer;
159
178
  margin-top: 10px;
160
179
  }
180
+ .liveness-challenge {
181
+ margin: 5px 0;
182
+ font-weight: bold;
183
+ font-size: 40px;
184
+ }
161
185
  .liveness-timer {
162
186
  margin: 10px 0;
163
187
  font-weight: bold;
@@ -203,7 +227,7 @@ classNames={{
203
227
 
204
228
  - Webcam permissions required
205
229
  - Backend must accept 5 frames in expected format
206
- - `apiUrl` must be reachable and have an endpoint `v1/verify`
230
+ - `apiUrl` must be reachable and have an endpoint `/v1/verify`
207
231
  - CORS must be configured properly
208
232
 
209
233
  ---