react-native-vision-camera-spoof-detector 1.0.28 → 1.1.7

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.

Potentially problematic release.


This version of react-native-vision-camera-spoof-detector might be problematic. Click here for more details.

Files changed (67) hide show
  1. package/.npmignore +16 -99
  2. package/README.md +5 -4
  3. package/android/CMakeLists.txt +29 -0
  4. package/android/build.gradle +26 -12
  5. package/android/fix-prefab.gradle +4 -0
  6. package/android/src/main/AndroidManifest.xml +1 -1
  7. package/android/src/main/cpp/CMakeLists.txt +18 -86
  8. package/android/src/main/cpp/FaceAntiSpoofJSI.cpp +80 -6
  9. package/android/src/main/cpp/cpp-adapter.cpp +9 -0
  10. package/android/src/main/java/com/faceantispoof/FaceAntiSpoofModule.kt +108 -103
  11. package/android/src/main/java/com/faceantispoof/FaceAntiSpoofPackage.kt +12 -27
  12. package/android/src/main/java/com/faceantispoof/FaceAntiSpoofingAdvanced.kt +58 -1
  13. package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorFactory.kt +15 -0
  14. package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorOutput.kt +107 -0
  15. package/index.d.ts +14 -1
  16. package/index.js +26 -57
  17. package/nitro.json +20 -0
  18. package/nitrogen/generated/.gitattributes +1 -0
  19. package/nitrogen/generated/android/VisionCameraSpoofDetector+autolinking.cmake +81 -0
  20. package/nitrogen/generated/android/VisionCameraSpoofDetector+autolinking.gradle +27 -0
  21. package/nitrogen/generated/android/VisionCameraSpoofDetectorOnLoad.cpp +58 -0
  22. package/nitrogen/generated/android/VisionCameraSpoofDetectorOnLoad.hpp +34 -0
  23. package/nitrogen/generated/android/c++/JAntiSpoofingResult.hpp +77 -0
  24. package/nitrogen/generated/android/c++/JFunc_void_AntiSpoofingResult.hpp +78 -0
  25. package/nitrogen/generated/android/c++/JFunc_void_std__exception_ptr.hpp +76 -0
  26. package/nitrogen/generated/android/c++/JHybridSpoofDetectorFactorySpec.cpp +75 -0
  27. package/nitrogen/generated/android/c++/JHybridSpoofDetectorFactorySpec.hpp +63 -0
  28. package/nitrogen/generated/android/c++/JSize.hpp +61 -0
  29. package/nitrogen/generated/android/c++/JSpoofDetectorOutputOptions.hpp +91 -0
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/AntiSpoofingResult.kt +76 -0
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/Func_void_AntiSpoofingResult.kt +78 -0
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/Func_void_std__exception_ptr.kt +78 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorFactorySpec.kt +57 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/Size.kt +56 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/SpoofDetectorOutputOptions.kt +65 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/VisionCameraSpoofDetectorOnLoad.kt +35 -0
  37. package/nitrogen/generated/shared/c++/AntiSpoofingResult.hpp +103 -0
  38. package/nitrogen/generated/shared/c++/HybridSpoofDetectorFactorySpec.cpp +21 -0
  39. package/nitrogen/generated/shared/c++/HybridSpoofDetectorFactorySpec.hpp +67 -0
  40. package/nitrogen/generated/shared/c++/Size.hpp +87 -0
  41. package/nitrogen/generated/shared/c++/SpoofDetectorOutputOptions.hpp +98 -0
  42. package/package.json +12 -13
  43. package/react-native-vision-camera-spoof-detector.podspec +4 -4
  44. package/src/specs/SpoofDetectorFactory.nitro.ts +23 -0
  45. package/.gitattributes +0 -2
  46. package/CONTRIBUTING.md +0 -280
  47. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  48. package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
  49. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  50. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  51. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  52. package/android/.gradle/8.9/gc.properties +0 -0
  53. package/android/.gradle/9.2.0/checksums/checksums.lock +0 -0
  54. package/android/.gradle/9.2.0/checksums/md5-checksums.bin +0 -0
  55. package/android/.gradle/9.2.0/checksums/sha1-checksums.bin +0 -0
  56. package/android/.gradle/9.2.0/fileChanges/last-build.bin +0 -0
  57. package/android/.gradle/9.2.0/fileHashes/fileHashes.bin +0 -0
  58. package/android/.gradle/9.2.0/fileHashes/fileHashes.lock +0 -0
  59. package/android/.gradle/9.2.0/gc.properties +0 -0
  60. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  61. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  62. package/android/.gradle/vcs-1/gc.properties +0 -0
  63. package/android/build/reports/problems/problems-report.html +0 -659
  64. package/android/src/main/assets/spoof_model_scale_2_7.tflite +0 -0
  65. package/android/src/main/assets/spoof_model_scale_4_0.tflite +0 -0
  66. package/android/src/main/java/com/faceantispoof/FaceAntiSpoofFrameProcessor.kt +0 -198
  67. /package/{android/src/main → lib}/assets/FaceAntiSpoofing.tflite +0 -0
@@ -0,0 +1,67 @@
1
+ ///
2
+ /// HybridSpoofDetectorFactorySpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `HybridCameraOutputSpec` to properly resolve imports.
17
+ namespace margelo::nitro::camera { class HybridCameraOutputSpec; }
18
+ // Forward declaration of `SpoofDetectorOutputOptions` to properly resolve imports.
19
+ namespace margelo::nitro::camera::spoofdetector { struct SpoofDetectorOutputOptions; }
20
+
21
+ #include <memory>
22
+ #include <VisionCamera/HybridCameraOutputSpec.hpp>
23
+ #include "SpoofDetectorOutputOptions.hpp"
24
+
25
+ namespace margelo::nitro::camera::spoofdetector {
26
+
27
+ using namespace margelo::nitro;
28
+
29
+ /**
30
+ * An abstract base class for `SpoofDetectorFactory`
31
+ * Inherit this class to create instances of `HybridSpoofDetectorFactorySpec` in C++.
32
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
33
+ * @example
34
+ * ```cpp
35
+ * class HybridSpoofDetectorFactory: public HybridSpoofDetectorFactorySpec {
36
+ * public:
37
+ * HybridSpoofDetectorFactory(...): HybridObject(TAG) { ... }
38
+ * // ...
39
+ * };
40
+ * ```
41
+ */
42
+ class HybridSpoofDetectorFactorySpec: public virtual HybridObject {
43
+ public:
44
+ // Constructor
45
+ explicit HybridSpoofDetectorFactorySpec(): HybridObject(TAG) { }
46
+
47
+ // Destructor
48
+ ~HybridSpoofDetectorFactorySpec() override = default;
49
+
50
+ public:
51
+ // Properties
52
+
53
+
54
+ public:
55
+ // Methods
56
+ virtual std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec> createSpoofDetectorOutput(const SpoofDetectorOutputOptions& options) = 0;
57
+
58
+ protected:
59
+ // Hybrid Setup
60
+ void loadHybridMethods() override;
61
+
62
+ protected:
63
+ // Tag for logging
64
+ static constexpr auto TAG = "SpoofDetectorFactory";
65
+ };
66
+
67
+ } // namespace margelo::nitro::camera::spoofdetector
@@ -0,0 +1,87 @@
1
+ ///
2
+ /// Size.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+
32
+
33
+
34
+
35
+ namespace margelo::nitro::camera::spoofdetector {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (Size).
39
+ */
40
+ struct Size final {
41
+ public:
42
+ double width SWIFT_PRIVATE;
43
+ double height SWIFT_PRIVATE;
44
+
45
+ public:
46
+ Size() = default;
47
+ explicit Size(double width, double height): width(width), height(height) {}
48
+
49
+ public:
50
+ friend bool operator==(const Size& lhs, const Size& rhs) = default;
51
+ };
52
+
53
+ } // namespace margelo::nitro::camera::spoofdetector
54
+
55
+ namespace margelo::nitro {
56
+
57
+ // C++ Size <> JS Size (object)
58
+ template <>
59
+ struct JSIConverter<margelo::nitro::camera::spoofdetector::Size> final {
60
+ static inline margelo::nitro::camera::spoofdetector::Size fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
61
+ jsi::Object obj = arg.asObject(runtime);
62
+ return margelo::nitro::camera::spoofdetector::Size(
63
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))),
64
+ JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))
65
+ );
66
+ }
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::camera::spoofdetector::Size& arg) {
68
+ jsi::Object obj(runtime);
69
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter<double>::toJSI(runtime, arg.width));
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter<double>::toJSI(runtime, arg.height));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!nitro::isPlainObject(runtime, obj)) {
79
+ return false;
80
+ }
81
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false;
82
+ if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -0,0 +1,98 @@
1
+ ///
2
+ /// SpoofDetectorOutputOptions.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+ // Forward declaration of `Size` to properly resolve imports.
32
+ namespace margelo::nitro::camera::spoofdetector { struct Size; }
33
+ // Forward declaration of `AntiSpoofingResult` to properly resolve imports.
34
+ namespace margelo::nitro::camera::spoofdetector { struct AntiSpoofingResult; }
35
+
36
+ #include "Size.hpp"
37
+ #include <optional>
38
+ #include "AntiSpoofingResult.hpp"
39
+ #include <functional>
40
+ #include <exception>
41
+
42
+ namespace margelo::nitro::camera::spoofdetector {
43
+
44
+ /**
45
+ * A struct which can be represented as a JavaScript object (SpoofDetectorOutputOptions).
46
+ */
47
+ struct SpoofDetectorOutputOptions final {
48
+ public:
49
+ std::optional<Size> targetResolution SWIFT_PRIVATE;
50
+ std::function<void(const AntiSpoofingResult& /* result */)> onResult SWIFT_PRIVATE;
51
+ std::optional<std::function<void(const std::exception_ptr& /* error */)>> onError SWIFT_PRIVATE;
52
+
53
+ public:
54
+ SpoofDetectorOutputOptions() = default;
55
+ explicit SpoofDetectorOutputOptions(std::optional<Size> targetResolution, std::function<void(const AntiSpoofingResult& /* result */)> onResult, std::optional<std::function<void(const std::exception_ptr& /* error */)>> onError): targetResolution(targetResolution), onResult(onResult), onError(onError) {}
56
+
57
+ public:
58
+ // SpoofDetectorOutputOptions is not equatable because these properties are not equatable: onResult, onError
59
+ };
60
+
61
+ } // namespace margelo::nitro::camera::spoofdetector
62
+
63
+ namespace margelo::nitro {
64
+
65
+ // C++ SpoofDetectorOutputOptions <> JS SpoofDetectorOutputOptions (object)
66
+ template <>
67
+ struct JSIConverter<margelo::nitro::camera::spoofdetector::SpoofDetectorOutputOptions> final {
68
+ static inline margelo::nitro::camera::spoofdetector::SpoofDetectorOutputOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
69
+ jsi::Object obj = arg.asObject(runtime);
70
+ return margelo::nitro::camera::spoofdetector::SpoofDetectorOutputOptions(
71
+ JSIConverter<std::optional<margelo::nitro::camera::spoofdetector::Size>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetResolution"))),
72
+ JSIConverter<std::function<void(const margelo::nitro::camera::spoofdetector::AntiSpoofingResult&)>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onResult"))),
73
+ JSIConverter<std::optional<std::function<void(const std::exception_ptr&)>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onError")))
74
+ );
75
+ }
76
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::camera::spoofdetector::SpoofDetectorOutputOptions& arg) {
77
+ jsi::Object obj(runtime);
78
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "targetResolution"), JSIConverter<std::optional<margelo::nitro::camera::spoofdetector::Size>>::toJSI(runtime, arg.targetResolution));
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "onResult"), JSIConverter<std::function<void(const margelo::nitro::camera::spoofdetector::AntiSpoofingResult&)>>::toJSI(runtime, arg.onResult));
80
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "onError"), JSIConverter<std::optional<std::function<void(const std::exception_ptr&)>>>::toJSI(runtime, arg.onError));
81
+ return obj;
82
+ }
83
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
84
+ if (!value.isObject()) {
85
+ return false;
86
+ }
87
+ jsi::Object obj = value.getObject(runtime);
88
+ if (!nitro::isPlainObject(runtime, obj)) {
89
+ return false;
90
+ }
91
+ if (!JSIConverter<std::optional<margelo::nitro::camera::spoofdetector::Size>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "targetResolution")))) return false;
92
+ if (!JSIConverter<std::function<void(const margelo::nitro::camera::spoofdetector::AntiSpoofingResult&)>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onResult")))) return false;
93
+ if (!JSIConverter<std::optional<std::function<void(const std::exception_ptr&)>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onError")))) return false;
94
+ return true;
95
+ }
96
+ };
97
+
98
+ } // namespace margelo::nitro
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-vision-camera-spoof-detector",
3
- "version": "1.0.28",
3
+ "version": "1.1.7",
4
4
  "description": "High-performance face anti-spoofing and liveness detection module for React Native Vision Camera. Uses TensorFlow Lite with GPU acceleration and optimized YUV processing.",
5
5
  "homepage": "https://github.com/dpraful/react-native-vision-camera-spoof-detector",
6
6
  "repository": {
@@ -10,7 +10,7 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/dpraful/react-native-vision-camera-spoof-detector/issues"
12
12
  },
13
- "license": "JSCON TECHNOLOGIES PVT LTD",
13
+ "license": "MIT",
14
14
  "author": {
15
15
  "name": "PRAFULDAS M M",
16
16
  "company": "JESCON TECHNOLOGIES PVT LTD",
@@ -28,17 +28,18 @@
28
28
  "types": "index.d.ts",
29
29
  "files": [
30
30
  "android/",
31
+ "lib/",
32
+ "src/",
33
+ "nitrogen/",
34
+ "nitro.json",
31
35
  "ios/",
32
- ".gitattributes",
33
- ".gitignore",
34
36
  ".npmignore",
35
37
  "CHANGELOG.md",
36
- "CONTRIBUTING.md",
37
- "index.js",
38
38
  "index.d.ts",
39
- "README.md",
39
+ "index.js",
40
40
  "LICENSE",
41
- "react-native-vision-camera-spoof-detector.podspec"
41
+ "react-native-vision-camera-spoof-detector.podspec",
42
+ "README.md"
42
43
  ],
43
44
  "keywords": [
44
45
  "react-native",
@@ -60,9 +61,9 @@
60
61
  "peerDependencies": {
61
62
  "react": ">=16.8.0",
62
63
  "react-native": ">=0.60.0",
63
- "react-native-vision-camera": "^4.6.4 || ^5.0.0",
64
- "react-native-reanimated": "^3.0.0",
65
- "react-native-worklets-core": "^1.0.0"
64
+ "react-native-vision-camera": "^5.0.0",
65
+ "react-native-vision-camera-worklets": "^5.0.0",
66
+ "react-native-worklets": "^0.12.0"
66
67
  },
67
68
  "peerDependenciesMeta": {
68
69
  "react-native-vision-camera-face-detector": {
@@ -72,8 +73,6 @@
72
73
  "devDependencies": {
73
74
  "react": "^18.2.0",
74
75
  "react-native": "^0.72.0",
75
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
76
- "@babel/plugin-proposal-optional-chaining": "^7.21.0",
77
76
  "typescript": "^5.0.0"
78
77
  },
79
78
  "engines": {
@@ -1,10 +1,10 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'react-native-vision-camera-spoof-detector'
3
- s.version = '0.1.0'
3
+ s.version = '1.1.0'
4
4
  s.summary = 'Face anti-spoof detector for VisionCamera (iOS)'
5
- s.homepage = 'https://example.com'
6
- s.license = { :type => 'MIT' }
7
- s.authors = { 'You' => 'you@example.com' }
5
+ s.homepage = 'https://github.com/dpraful/react-native-vision-camera-spoof-detector'
6
+ s.license = { :type => 'MIT', :file => 'LICENSE' }
7
+ s.authors = { 'JESCON TECHNOLOGIES PVT LTD' => 'jescontechnologies@gmail.com' }
8
8
  s.platform = :ios, '11.0'
9
9
  s.source = { :path => '.' }
10
10
 
@@ -0,0 +1,23 @@
1
+ import type { CameraOutput, Size } from 'react-native-vision-camera'
2
+ import type { HybridObject } from 'react-native-nitro-modules'
3
+
4
+ export interface AntiSpoofingResult {
5
+ isLive: boolean
6
+ label: string
7
+ neuralNetworkScore: number
8
+ laplacianScore: number
9
+ combinedScore: number
10
+ confidence: number
11
+ }
12
+
13
+ export interface SpoofDetectorOutputOptions {
14
+ targetResolution?: Size
15
+ onResult: (result: AntiSpoofingResult) => void
16
+ onError?: (error: Error) => void
17
+ }
18
+
19
+ export interface SpoofDetectorFactory extends HybridObject<{
20
+ android: 'kotlin'
21
+ }> {
22
+ createSpoofDetectorOutput(options: SpoofDetectorOutputOptions): CameraOutput
23
+ }
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
package/CONTRIBUTING.md DELETED
@@ -1,280 +0,0 @@
1
- # Contributing to react-native-vision-camera-spoof-detector
2
-
3
- First off, thank you for considering contributing to **react-native-vision-camera-spoof-detector**! It's people like you that make this library such a great tool.
4
-
5
- ## Code of Conduct
6
-
7
- This project and everyone participating in it is governed by our [Code of Conduct](./CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
8
-
9
- ## How Can I Contribute?
10
-
11
- ### Reporting Bugs
12
-
13
- Before creating bug reports, please check the issue list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
14
-
15
- - **Use a clear and descriptive title**
16
- - **Describe the exact steps which reproduce the problem** in as many details as possible
17
- - **Provide specific examples to demonstrate the steps**
18
- - **Describe the behavior you observed after following the steps**
19
- - **Explain which behavior you expected to see instead and why**
20
- - **Include screenshots and animated GIFs** if possible
21
- - **Include your environment details**:
22
- - React Native version
23
- - Device/OS version
24
- - Library version
25
- - Any relevant plugin versions
26
-
27
- ### Suggesting Enhancements
28
-
29
- Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
30
-
31
- - **Use a clear and descriptive title**
32
- - **Provide a step-by-step description of the suggested enhancement**
33
- - **Provide specific examples to demonstrate the steps**
34
- - **Describe the current behavior** and **the expected behavior**
35
- - **Explain why this enhancement would be useful**
36
-
37
- ### Pull Requests
38
-
39
- - Fill in the required template
40
- - Follow the TypeScript/JavaScript styleguides
41
- - End all files with a newline
42
- - Avoid platform-dependent code
43
-
44
- ## Development Setup
45
-
46
- ### Prerequisites
47
-
48
- - Node.js >= 16.0.0
49
- - npm >= 8.0.0 or yarn
50
- - React Native >= 0.60.0
51
- - Android SDK (for Android development)
52
- - Xcode (for iOS development, when available)
53
-
54
- ### Installation
55
-
56
- 1. **Fork the repository**
57
-
58
- ```bash
59
- git clone https://github.com/YOUR_USERNAME/react-native-vision-camera-spoof-detector.git
60
- cd react-native-vision-camera-spoof-detector
61
- ```
62
-
63
- 2. **Install dependencies**
64
-
65
- ```bash
66
- npm install
67
- # or
68
- yarn install
69
- ```
70
-
71
- 3. **Install peer dependencies**
72
-
73
- ```bash
74
- npm install react-native-vision-camera react-native-reanimated react-native-worklets-core
75
- ```
76
-
77
- 4. **Set up development environment**
78
-
79
- For Android development, ensure your Android SDK is properly configured.
80
-
81
- ### Building and Testing
82
-
83
- ```bash
84
- # Build the project
85
- npm run build
86
-
87
- # Run type checking
88
- npm run type-check
89
-
90
- # Run linter
91
- npm run lint
92
-
93
- # Run tests
94
- npm run test
95
-
96
- # Watch mode for development
97
- npm run dev
98
- ```
99
-
100
- ## Styleguides
101
-
102
- ### Git Commit Messages
103
-
104
- - Use the present tense ("Add feature" not "Added feature")
105
- - Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
106
- - Limit the first line to 72 characters or less
107
- - Reference issues and pull requests liberally after the first line
108
- - Consider starting the commit message with an applicable emoji:
109
- - 🎨 `:art:` - Improving structure/format
110
- - 🐛 `:bug:` - Bug fix
111
- - ⚡ `:zap:` - Performance improvement
112
- - 📚 `:books:` - Documentation
113
- - ✅ `:white_check_mark:` - Tests
114
- - 🔧 `:wrench:` - Configuration
115
- - 🚀 `:rocket:` - New feature
116
- - 🔒 `:lock:` - Security
117
- - ♻️ `:recycle:` - Refactoring
118
-
119
- ### JavaScript/TypeScript Styleguide
120
-
121
- All code must adhere to the following standards:
122
-
123
- - Use TypeScript for all new code
124
- - Write clear, self-documenting code
125
- - Use meaningful variable and function names
126
- - Add JSDoc comments for public APIs
127
- - Follow ESLint configuration
128
- - Maximum line length: 100 characters
129
- - Use semicolons
130
- - Use single quotes for strings
131
- - Use 2 spaces for indentation
132
-
133
- #### Example:
134
-
135
- ```typescript
136
- /**
137
- * Detects if face is centered in frame
138
- * @param faceRect - Face rectangle bounds
139
- * @param frameWidth - Frame width in pixels
140
- * @param frameHeight - Frame height in pixels
141
- * @returns True if face is centered
142
- */
143
- export const isFaceCentered = (
144
- faceRect: FaceRect,
145
- frameWidth: number,
146
- frameHeight: number
147
- ): boolean => {
148
- const faceCenterX = faceRect.x + faceRect.width / 2;
149
- const faceCenterY = faceRect.y + faceRect.height / 2;
150
- const frameCenterX = frameWidth / 2;
151
- const frameCenterY = frameHeight / 2;
152
-
153
- return (
154
- Math.abs(faceCenterX - frameCenterX) <= frameWidth * 0.2 &&
155
- Math.abs(faceCenterY - frameCenterY) <= frameHeight * 0.15
156
- );
157
- };
158
- ```
159
-
160
- ### Documentation Styleguide
161
-
162
- - Use Markdown
163
- - Reference functions/classes/methods with backticks: `functionName()`
164
- - Use code blocks with language identifiers: \`\`\`javascript
165
- - Include examples where applicable
166
- - Keep paragraphs short and scannable
167
-
168
- ## Testing
169
-
170
- ### Writing Tests
171
-
172
- All code changes should include corresponding tests:
173
-
174
- ```typescript
175
- describe('isFaceCentered', () => {
176
- it('should return true when face is centered', () => {
177
- const faceRect = { x: 75, y: 50, width: 50, height: 50 };
178
- const result = isFaceCentered(faceRect, 200, 200);
179
- expect(result).toBe(true);
180
- });
181
-
182
- it('should return false when face is off-center', () => {
183
- const faceRect = { x: 10, y: 10, width: 50, height: 50 };
184
- const result = isFaceCentered(faceRect, 200, 200);
185
- expect(result).toBe(false);
186
- });
187
- });
188
- ```
189
-
190
- ### Running Tests
191
-
192
- ```bash
193
- npm run test
194
-
195
- # Watch mode
196
- npm run test:watch
197
-
198
- # Coverage
199
- npm run test:coverage
200
- ```
201
-
202
- ## Documentation Updates
203
-
204
- If your changes affect the documented behavior, please update the README or relevant documentation files. This includes:
205
-
206
- - New APIs
207
- - Changed behavior
208
- - New examples
209
- - Configuration options
210
-
211
- ## Performance Considerations
212
-
213
- When adding new features, consider:
214
-
215
- - Impact on frame processing performance
216
- - Memory usage and garbage collection
217
- - GPU vs CPU acceleration trade-offs
218
- - Compatibility with older devices
219
-
220
- ## Accessibility
221
-
222
- - Ensure code is accessible to developers with different levels of experience
223
- - Write clear comments for complex logic
224
- - Provide examples for new features
225
-
226
- ## Community
227
-
228
- - Use inclusive language
229
- - Be respectful and professional
230
- - Help other contributors when possible
231
- - Share knowledge and experience
232
-
233
- ## Additional Notes
234
-
235
- ### Code Review Process
236
-
237
- 1. Automated tests must pass
238
- 2. Code must follow style guidelines
239
- 3. Documentation must be updated
240
- 4. At least one maintainer review required
241
- 5. All conversations must be professional
242
-
243
- ### Priorities
244
-
245
- When choosing what to work on:
246
-
247
- 1. **High Priority**: Bug fixes, security issues
248
- 2. **Medium Priority**: Feature enhancements, performance improvements
249
- 3. **Low Priority**: Documentation, examples, refactoring
250
-
251
- ## License
252
-
253
- By contributing, you agree that your contributions will be licensed under its JESCON TECHNOLOGIES PVT LTD License.
254
-
255
- ## Recognition
256
-
257
- Contributors will be recognized in:
258
-
259
- - README.md contributors section
260
- - CHANGELOG.md release notes
261
- - GitHub contributors page
262
-
263
- ## Questions?
264
-
265
- - 📧 Email: jescontechnologies@gmail.com
266
- - 💬 [GitHub Issues](https://github.com/dpraful/react-native-vision-camera-spoof-detector/issues)
267
- - 📝 [GitHub Discussions](https://github.com/dpraful/react-native-vision-camera-spoof-detector/discussions)
268
-
269
- ## Additional Resources
270
-
271
- - [React Native Documentation](https://reactnative.dev/)
272
- - [Vision Camera Documentation](https://react-native-vision-camera.com/)
273
- - [TensorFlow Lite Guide](https://www.tensorflow.org/lite)
274
- - [TypeScript Handbook](https://www.typescriptlang.org/docs/)
275
-
276
- ---
277
-
278
- Thank you for contributing! 🙏
279
-
280
- Made with ❤️ by JESCON TECHNOLOGIES PVT LTD
File without changes
File without changes
@@ -1,2 +0,0 @@
1
- #Thu Sep 03 17:06:38 IST 2026
2
- gradle.version=8.9
File without changes