@rick427/react-native-liveness 0.1.0 → 0.1.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 +35 -15
- package/android/build.gradle +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @rick427/react-native-liveness
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@rick427/react-native-liveness)
|
|
4
|
+
[](https://www.npmjs.com/package/@rick427/react-native-liveness)
|
|
5
|
+
[](https://github.com/rick427/react-native-liveness/actions/workflows/ci.yml)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
[](https://github.com/rick427/react-native-liveness)
|
|
8
|
+
|
|
3
9
|
A React Native library for real-time **liveness detection** using the device's front camera. Powered by [Vision Camera v4](https://github.com/mrousavy/react-native-vision-camera) and **ML Kit Face Detection** — no server required, fully on-device.
|
|
4
10
|
|
|
5
11
|
The library scores each camera frame against a set of liveness signals (face size, head pose, eye openness), confirms liveness after a sustained high-score window, then automatically counts down **3 → 2 → 1**, plays a shutter sound, and captures the photo.
|
|
@@ -18,41 +24,55 @@ The library scores each camera frame against a set of liveness signals (face siz
|
|
|
18
24
|
|
|
19
25
|
---
|
|
20
26
|
|
|
21
|
-
##
|
|
27
|
+
## Installation
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
```sh
|
|
30
|
+
npm install @rick427/react-native-liveness
|
|
31
|
+
# or
|
|
32
|
+
yarn add @rick427/react-native-liveness
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Peer dependencies
|
|
36
|
+
|
|
37
|
+
Install these if you don't already have them:
|
|
24
38
|
|
|
25
39
|
| Package | Version |
|
|
26
40
|
|---|---|
|
|
27
41
|
| `react-native-vision-camera` | `>= 4.0.0` |
|
|
28
|
-
| `react-native-worklets-core` | `>= 1.0.0` |
|
|
29
42
|
| `react-native-svg` | `>= 13.0.0` |
|
|
43
|
+
| `react-native-worklets-core` | `>= 1.0.0` |
|
|
30
44
|
|
|
31
45
|
```sh
|
|
32
|
-
npm install react-native-vision-camera react-native-
|
|
46
|
+
npm install react-native-vision-camera react-native-svg react-native-worklets-core
|
|
33
47
|
```
|
|
34
48
|
|
|
35
|
-
|
|
49
|
+
### Configure worklets Babel plugin
|
|
36
50
|
|
|
37
|
-
|
|
51
|
+
The library uses Vision Camera frame processors which run in a worklet context. Add the appropriate plugin to your `babel.config.js` depending on which package you have installed:
|
|
38
52
|
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
53
|
+
```js
|
|
54
|
+
// babel.config.js
|
|
55
|
+
module.exports = {
|
|
56
|
+
presets: ['module:@react-native/babel-preset'], // or 'babel-preset-expo'
|
|
57
|
+
plugins: [
|
|
58
|
+
['react-native-worklets-core/plugin'], // if using react-native-worklets-core
|
|
59
|
+
// ['react-native-worklets/plugin'], // if using react-native-worklets
|
|
60
|
+
],
|
|
61
|
+
};
|
|
43
62
|
```
|
|
44
63
|
|
|
45
|
-
|
|
64
|
+
> **Already have worklets configured?** Just confirm the relevant plugin line is present — no further changes needed.
|
|
65
|
+
|
|
66
|
+
After updating the Babel config, clear the Metro cache:
|
|
46
67
|
|
|
47
68
|
```sh
|
|
48
|
-
|
|
49
|
-
|
|
69
|
+
npx react-native start --reset-cache
|
|
70
|
+
# or with Expo
|
|
71
|
+
npx expo start --clear
|
|
50
72
|
```
|
|
51
73
|
|
|
52
74
|
### iOS
|
|
53
75
|
|
|
54
|
-
Add the ML Kit pod (already declared in the podspec, but run pod install):
|
|
55
|
-
|
|
56
76
|
```sh
|
|
57
77
|
cd ios && pod install
|
|
58
78
|
```
|
package/android/build.gradle
CHANGED
|
@@ -69,8 +69,9 @@ repositories {
|
|
|
69
69
|
dependencies {
|
|
70
70
|
implementation "com.facebook.react:react-android"
|
|
71
71
|
|
|
72
|
-
// Vision Camera
|
|
73
|
-
|
|
72
|
+
// Vision Camera — resolved from the consumer's node_modules via auto-linking,
|
|
73
|
+
// not from Maven. compileOnly = available at compile time, provided at runtime.
|
|
74
|
+
compileOnly project(':react-native-vision-camera')
|
|
74
75
|
|
|
75
76
|
// ML Kit Face Detection
|
|
76
77
|
implementation "com.google.mlkit:face-detection:16.1.7"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rick427/react-native-liveness",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Liveness detection library for React Native using Vision Camera v4 and ML Kit",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|