@regulaforensics/face-sdk 7.2.429-beta → 7.2.433-rc
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 +3 -2
- package/RNFaceSDK.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/cordova.gradle +2 -2
- package/android/src/main/java/com/regula/plugin/facesdk/JSONConstructor.kt +0 -2
- package/android/src/main/java/com/regula/plugin/facesdk/Main.kt +0 -18
- package/examples/capacitor/android/app/src/main/AndroidManifest.xml +2 -2
- package/examples/capacitor/index.html +7 -2
- package/examples/capacitor/package-lock.json +162 -12
- package/examples/capacitor/package.json +4 -4
- package/examples/capacitor/scripts/setup.sh +2 -4
- package/examples/capacitor/src/main.css +6 -60
- package/examples/capacitor/src/main.html +1 -1
- package/examples/capacitor/src/main.tsx +87 -51
- package/examples/cordova/.vscode/launch.json +28 -0
- package/examples/cordova/README.md +25 -0
- package/examples/cordova/config.xml +26 -0
- package/examples/cordova/package-lock.json +1327 -0
- package/examples/cordova/package.json +30 -0
- package/examples/cordova/scripts/android.sh +8 -0
- package/examples/cordova/scripts/ios.sh +8 -0
- package/examples/cordova/scripts/setup.sh +8 -0
- package/examples/cordova/www/images/logo.png +0 -0
- package/examples/cordova/www/index.html +21 -0
- package/examples/cordova/www/src/main.css +83 -0
- package/examples/cordova/www/src/main.html +25 -0
- package/examples/cordova/www/src/main.js +152 -0
- package/examples/ionic/README.md +1 -1
- package/examples/ionic/angular.json +3 -3
- package/examples/ionic/config.xml +2 -4
- package/examples/ionic/index.ts +17 -0
- package/examples/ionic/package-lock.json +68 -42
- package/examples/ionic/package.json +2 -2
- package/examples/ionic/src/images/portrait.png +0 -0
- package/examples/ionic/src/main.css +6 -60
- package/examples/ionic/src/main.html +1 -1
- package/examples/ionic/src/{main.tsx → main.ts} +97 -52
- package/examples/ionic/tsconfig.json +2 -3
- package/examples/react_native/README.md +0 -1
- package/examples/react_native/app.config.ts +1 -1
- package/examples/react_native/index.tsx +7 -49
- package/examples/react_native/package-lock.json +597 -594
- package/examples/react_native/package.json +9 -9
- package/examples/react_native/src/main.css +6 -60
- package/examples/react_native/src/main.html +1 -1
- package/examples/react_native/src/main.tsx +77 -54
- package/ios/RFSWJSONConstructor.h +1 -0
- package/ios/RFSWJSONConstructor.m +14 -5
- package/ios/RFSWMain.m +0 -30
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/www/capacitor/customization/customization_fonts.js +1 -1
- package/www/capacitor/customization/customization_images.js +1 -1
- package/www/capacitor/customization/font.js +0 -8
- package/www/capacitor/detect_faces/detect_face_result.js +0 -12
- package/www/capacitor/detect_faces/detect_faces_attribute_result.js +0 -9
- package/www/capacitor/detect_faces/detect_faces_backend_exception.js +0 -7
- package/www/capacitor/detect_faces/detect_faces_config.js +0 -34
- package/www/capacitor/detect_faces/detect_faces_exception.js +0 -8
- package/www/capacitor/detect_faces/detect_faces_request.js +0 -22
- package/www/capacitor/detect_faces/detect_faces_response.js +0 -9
- package/www/capacitor/face_capture/face_capture_config.js +0 -37
- package/www/capacitor/face_capture/face_capture_exception.js +0 -7
- package/www/capacitor/face_capture/face_capture_image.js +0 -8
- package/www/capacitor/face_capture/face_capture_response.js +0 -7
- package/www/capacitor/image_params/output_image_crop.js +0 -23
- package/www/capacitor/image_params/output_image_params.js +0 -19
- package/www/capacitor/image_params/point.js +0 -7
- package/www/capacitor/image_params/rect.js +0 -9
- package/www/capacitor/image_params/size.js +0 -12
- package/www/capacitor/image_quality/image_quality_characteristic.js +0 -22
- package/www/capacitor/image_quality/image_quality_range.js +0 -7
- package/www/capacitor/image_quality/image_quality_result.js +0 -10
- package/www/capacitor/index.js +0 -48
- package/www/capacitor/init/face_sdk_version.js +0 -8
- package/www/capacitor/init/init_config.js +0 -19
- package/www/capacitor/init/init_exception.js +0 -8
- package/www/capacitor/init/license_exception.js +0 -7
- package/www/capacitor/internal/bridge.js +1 -20
- package/www/capacitor/liveness/liveness_backend_exception.js +0 -7
- package/www/capacitor/liveness/liveness_config.js +0 -43
- package/www/capacitor/liveness/liveness_exception.js +0 -8
- package/www/capacitor/liveness/liveness_notification.js +0 -7
- package/www/capacitor/liveness/liveness_response.js +0 -11
- package/www/capacitor/match_faces/compared_face.js +0 -9
- package/www/capacitor/match_faces/compared_faces_pair.js +0 -10
- package/www/capacitor/match_faces/compared_faces_split.js +0 -7
- package/www/capacitor/match_faces/match_faces_backend_exception.js +0 -7
- package/www/capacitor/match_faces/match_faces_config.js +0 -19
- package/www/capacitor/match_faces/match_faces_detection.js +0 -9
- package/www/capacitor/match_faces/match_faces_detection_face.js +0 -11
- package/www/capacitor/match_faces/match_faces_exception.js +0 -8
- package/www/capacitor/match_faces/match_faces_image.js +0 -9
- package/www/capacitor/match_faces/match_faces_request.js +0 -27
- package/www/capacitor/match_faces/match_faces_response.js +0 -9
- package/www/capacitor/person_database/edit_group_persons_request.js +0 -15
- package/www/capacitor/person_database/image_upload.js +0 -17
- package/www/capacitor/person_database/pageable_item_list.js +0 -8
- package/www/capacitor/person_database/person.js +0 -13
- package/www/capacitor/person_database/person_group.js +0 -11
- package/www/capacitor/person_database/person_image.js +0 -13
- package/www/capacitor/person_database/search_person.js +0 -14
- package/www/capacitor/person_database/search_person_detection.js +0 -9
- package/www/capacitor/person_database/search_person_image.js +0 -15
- package/www/capacitor/person_database/search_person_request.js +0 -29
- package/www/cordova.js +6 -753
- package/www/react-native/customization/customization_fonts.js +1 -1
- package/www/react-native/customization/customization_images.js +1 -1
- package/www/react-native/customization/font.js +0 -8
- package/www/react-native/detect_faces/detect_face_result.js +0 -12
- package/www/react-native/detect_faces/detect_faces_attribute_result.js +0 -9
- package/www/react-native/detect_faces/detect_faces_backend_exception.js +0 -7
- package/www/react-native/detect_faces/detect_faces_config.js +0 -34
- package/www/react-native/detect_faces/detect_faces_exception.js +0 -8
- package/www/react-native/detect_faces/detect_faces_request.js +0 -22
- package/www/react-native/detect_faces/detect_faces_response.js +0 -9
- package/www/react-native/face_capture/face_capture_config.js +0 -37
- package/www/react-native/face_capture/face_capture_exception.js +0 -7
- package/www/react-native/face_capture/face_capture_image.js +0 -8
- package/www/react-native/face_capture/face_capture_response.js +0 -7
- package/www/react-native/image_params/output_image_crop.js +0 -23
- package/www/react-native/image_params/output_image_params.js +0 -19
- package/www/react-native/image_params/point.js +0 -7
- package/www/react-native/image_params/rect.js +0 -9
- package/www/react-native/image_params/size.js +0 -12
- package/www/react-native/image_quality/image_quality_characteristic.js +0 -22
- package/www/react-native/image_quality/image_quality_range.js +0 -7
- package/www/react-native/image_quality/image_quality_result.js +0 -10
- package/www/react-native/index.js +0 -48
- package/www/react-native/init/face_sdk_version.js +0 -8
- package/www/react-native/init/init_config.js +0 -19
- package/www/react-native/init/init_exception.js +0 -8
- package/www/react-native/init/license_exception.js +0 -7
- package/www/react-native/internal/bridge.js +1 -20
- package/www/react-native/liveness/liveness_backend_exception.js +0 -7
- package/www/react-native/liveness/liveness_config.js +0 -43
- package/www/react-native/liveness/liveness_exception.js +0 -8
- package/www/react-native/liveness/liveness_notification.js +0 -7
- package/www/react-native/liveness/liveness_response.js +0 -11
- package/www/react-native/match_faces/compared_face.js +0 -9
- package/www/react-native/match_faces/compared_faces_pair.js +0 -10
- package/www/react-native/match_faces/compared_faces_split.js +0 -7
- package/www/react-native/match_faces/match_faces_backend_exception.js +0 -7
- package/www/react-native/match_faces/match_faces_config.js +0 -19
- package/www/react-native/match_faces/match_faces_detection.js +0 -9
- package/www/react-native/match_faces/match_faces_detection_face.js +0 -11
- package/www/react-native/match_faces/match_faces_exception.js +0 -8
- package/www/react-native/match_faces/match_faces_image.js +0 -9
- package/www/react-native/match_faces/match_faces_request.js +0 -27
- package/www/react-native/match_faces/match_faces_response.js +0 -9
- package/www/react-native/person_database/edit_group_persons_request.js +0 -15
- package/www/react-native/person_database/image_upload.js +0 -17
- package/www/react-native/person_database/pageable_item_list.js +0 -8
- package/www/react-native/person_database/person.js +0 -13
- package/www/react-native/person_database/person_group.js +0 -11
- package/www/react-native/person_database/person_image.js +0 -13
- package/www/react-native/person_database/search_person.js +0 -14
- package/www/react-native/person_database/search_person_detection.js +0 -9
- package/www/react-native/person_database/search_person_image.js +0 -15
- package/www/react-native/person_database/search_person_request.js +0 -29
- package/www/types/index.d.ts +0 -12
- package/www/types/match_faces/match_faces_config.d.ts +0 -2
- package/www/types/person_database/search_person_request.d.ts +0 -4
- package/examples/capacitor/index.tsx +0 -53
- package/examples/ionic/index.tsx +0 -68
- package/test/json.tsx +0 -375
- package/test/package-lock.json +0 -584
- package/test/package.json +0 -9
- package/test/test.tsx +0 -61
- package/test/utils.tsx +0 -38
- /package/examples/{ionic → cordova/www}/images/portrait.png +0 -0
- /package/examples/ionic/{assets → src/assets}/.gitkeep +0 -0
- /package/examples/ionic/{images → src/images}/icon.png +0 -0
|
@@ -1,21 +1,17 @@
|
|
|
1
|
+
import '@ionic/react/css/core.css'
|
|
2
|
+
import './main.css'
|
|
3
|
+
import { setupIonicReact } from '@ionic/react'
|
|
4
|
+
import { StatusBar, Style } from '@capacitor/status-bar'
|
|
5
|
+
import { File } from '@awesome-cordova-plugins/file'
|
|
6
|
+
import { Dialog } from '@capacitor/dialog'
|
|
7
|
+
import { Camera, DestinationType, MediaType, PictureSourceType } from '@awesome-cordova-plugins/camera'
|
|
1
8
|
import { FaceSDK, MatchFacesRequest, MatchFacesImage, InitConfig, LivenessSkipStep, ImageType, LivenessStatus, LivenessConfig } from '@regulaforensics/face-sdk'
|
|
2
|
-
import { loadAssetIfExists, chooseOption, pickImage } from '../index'
|
|
3
|
-
|
|
4
|
-
var faceSdk = FaceSDK.instance
|
|
5
|
-
var image1: MatchFacesImage | null
|
|
6
|
-
var image2: MatchFacesImage | null
|
|
7
9
|
|
|
8
10
|
async function init() {
|
|
9
11
|
if (!await initializeReader()) return
|
|
10
12
|
setStatus("Ready")
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
async function startFaceCapture(position: number) {
|
|
14
|
-
var image = (await faceSdk.startFaceCapture()).image
|
|
15
|
-
if (image == null) return
|
|
16
|
-
setImage("data:image/png;base64," + image.image, image.imageType, position)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
15
|
async function startLiveness() {
|
|
20
16
|
var response = await faceSdk.startLiveness({
|
|
21
17
|
config: new LivenessConfig({
|
|
@@ -46,29 +42,13 @@ async function matchFaces() {
|
|
|
46
42
|
setStatus("Ready")
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (source == null) return
|
|
52
|
-
if (source) startFaceCapture(position)
|
|
53
|
-
else {
|
|
54
|
-
var image = await pickImage()
|
|
55
|
-
if (image == null) return
|
|
56
|
-
setImage(image, ImageType.PRINTED, position)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function setImage(base64: string, type: number, position: number) {
|
|
45
|
+
function clearResults() {
|
|
46
|
+
setStatus("Ready")
|
|
61
47
|
setSimilarityStatus("null")
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
setLivenessStatus("null")
|
|
67
|
-
}
|
|
68
|
-
if (position == 2) {
|
|
69
|
-
image2 = mfImage
|
|
70
|
-
setUiImage2(base64)
|
|
71
|
-
}
|
|
48
|
+
setLivenessStatus("null")
|
|
49
|
+
resetImages()
|
|
50
|
+
image1 = null
|
|
51
|
+
image2 = null
|
|
72
52
|
}
|
|
73
53
|
|
|
74
54
|
// If 'regula.license' exists, init using license(enables offline match)
|
|
@@ -81,36 +61,92 @@ async function initializeReader() {
|
|
|
81
61
|
if (license != null) config = new InitConfig(license)
|
|
82
62
|
var [success, error] = await faceSdk.initialize({ config: config })
|
|
83
63
|
|
|
84
|
-
if (error != null) {
|
|
64
|
+
if (!success && error != null) {
|
|
85
65
|
setStatus(error.message)
|
|
86
66
|
console.log(error.code + ": " + error.message)
|
|
87
67
|
}
|
|
88
68
|
return success
|
|
89
69
|
}
|
|
90
70
|
|
|
91
|
-
|
|
71
|
+
function setImage(base64: string, type: number, position: number) {
|
|
72
|
+
setSimilarityStatus("null")
|
|
73
|
+
var mfImage = new MatchFacesImage(base64, type)
|
|
74
|
+
if (position == 1) {
|
|
75
|
+
image1 = mfImage
|
|
76
|
+
setUiImage1(base64)
|
|
77
|
+
setLivenessStatus("null")
|
|
78
|
+
}
|
|
79
|
+
if (position == 2) {
|
|
80
|
+
image2 = mfImage
|
|
81
|
+
setUiImage2(base64)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
92
84
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
async function useCamera(position: number) {
|
|
86
|
+
var response = await faceSdk.startFaceCapture()
|
|
87
|
+
if (response.image == null) return
|
|
88
|
+
var image = response.image
|
|
89
|
+
setImage("data:image/png;base64," + image.image, image.imageType, position)
|
|
90
|
+
}
|
|
99
91
|
|
|
100
|
-
|
|
92
|
+
async function useGallery(position: number) {
|
|
93
|
+
var image = await Camera.getPicture({
|
|
94
|
+
destinationType: DestinationType.DATA_URL,
|
|
95
|
+
mediaType: MediaType.PICTURE,
|
|
96
|
+
sourceType: PictureSourceType.PHOTOLIBRARY
|
|
97
|
+
})
|
|
98
|
+
setImage(image, ImageType.PRINTED, position)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function pickImage(position: number) {
|
|
102
|
+
var response = await Dialog.confirm({
|
|
103
|
+
message: "Select option",
|
|
104
|
+
okButtonTitle: "Use camera",
|
|
105
|
+
cancelButtonTitle: "Use gallery"
|
|
106
|
+
})
|
|
107
|
+
if (response.value) useCamera(position)
|
|
108
|
+
else useGallery(position)
|
|
101
109
|
}
|
|
102
110
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
var
|
|
111
|
+
async function loadAssetIfExists(path: string): Promise<string | null> {
|
|
112
|
+
try {
|
|
113
|
+
var dir = await File.resolveDirectoryUrl(File.applicationDirectory + "public/assets")
|
|
114
|
+
var fileEntry = await File.getFile(dir, path, null)
|
|
115
|
+
var result = await new Promise<string | null>((resolve, _) => {
|
|
116
|
+
fileEntry.file(file => {
|
|
117
|
+
var reader = new FileReader()
|
|
118
|
+
reader.onloadend = (_) => resolve(reader.result as string)
|
|
119
|
+
reader.readAsDataURL(file)
|
|
120
|
+
}, _ => resolve(null))
|
|
121
|
+
})
|
|
122
|
+
return result
|
|
123
|
+
} catch (_) {
|
|
124
|
+
return null
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
var faceSdk = FaceSDK.instance
|
|
129
|
+
var image1: MatchFacesImage | null
|
|
130
|
+
var image2: MatchFacesImage | null
|
|
131
|
+
|
|
132
|
+
var setStatus = (data: string) => document.getElementById("status").innerHTML = data
|
|
133
|
+
var setLivenessStatus = (data: string) => document.getElementById("liveness-status").innerHTML = data
|
|
134
|
+
var setSimilarityStatus = (data: string) => document.getElementById("similarity-status").innerHTML = data
|
|
106
135
|
var setUiImage1 = (data: string) => (document.getElementById("first-image") as HTMLImageElement).src = data
|
|
107
136
|
var setUiImage2 = (data: string) => (document.getElementById("second-image") as HTMLImageElement).src = data
|
|
108
|
-
var
|
|
109
|
-
setStatus("Ready")
|
|
110
|
-
setSimilarityStatus("null")
|
|
111
|
-
setLivenessStatus("null")
|
|
137
|
+
var resetImages = () => {
|
|
112
138
|
setUiImage1("images/portrait.png")
|
|
113
139
|
setUiImage2("images/portrait.png")
|
|
114
|
-
image1 = null
|
|
115
|
-
image2 = null
|
|
116
140
|
}
|
|
141
|
+
|
|
142
|
+
setupIonicReact()
|
|
143
|
+
StatusBar.setStyle({ style: Style.Light })
|
|
144
|
+
document.addEventListener('deviceready', () => {
|
|
145
|
+
document.getElementById("first-image").onclick = () => pickImage(1)
|
|
146
|
+
document.getElementById("second-image").onclick = () => pickImage(2)
|
|
147
|
+
document.getElementById("match-faces").onclick = () => matchFaces()
|
|
148
|
+
document.getElementById("start-liveness").onclick = () => startLiveness()
|
|
149
|
+
document.getElementById("clear-results").onclick = () => clearResults()
|
|
150
|
+
|
|
151
|
+
init()
|
|
152
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Debug Android on emulator",
|
|
9
|
+
"type": "cordova",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"platform": "android",
|
|
12
|
+
"target": "emulator",
|
|
13
|
+
"port": 9222,
|
|
14
|
+
"sourceMaps": true,
|
|
15
|
+
"cwd": "${workspaceFolder}"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Debug Android on device",
|
|
19
|
+
"type": "cordova",
|
|
20
|
+
"request": "launch",
|
|
21
|
+
"platform": "android",
|
|
22
|
+
"target": "device",
|
|
23
|
+
"port": 9222,
|
|
24
|
+
"sourceMaps": true,
|
|
25
|
+
"cwd": "${workspaceFolder}"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Regula Face SDK Cordova demo application
|
|
2
|
+
|
|
3
|
+
## How to build demo application
|
|
4
|
+
1. Download or the clone current repository using the command `git clone https://github.com/regulaforensics/npm-face-sdk.git`.
|
|
5
|
+
|
|
6
|
+
2. Execute `npm run setup` within this directory.
|
|
7
|
+
|
|
8
|
+
3. Run the app:
|
|
9
|
+
* IOS: `npm run ios`.
|
|
10
|
+
* Android: `npm run android`.
|
|
11
|
+
|
|
12
|
+
**Note**: this is just one way of running the app. You can also pass `-o` or `--open` argument to the command, and this will open Xcode/Android Studio, then run the app directly from the IDE. Overall, this is a more consistent way, so if you're having troubles running the app from terminal, try running it from the IDE.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## How to use offline match
|
|
16
|
+
1. Place a license that supports offline match at `www/regula.license`.
|
|
17
|
+
|
|
18
|
+
2. Change core with the following commands:
|
|
19
|
+
```bash
|
|
20
|
+
cordova plugin remove @regulaforensics/face-core-basic
|
|
21
|
+
cordova plugin add @regulaforensics/face-core-match
|
|
22
|
+
npm run setup
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. Turn off the internet and run the app.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<widget android-packageName="com.regula.documentreader.api.androidtest" ios-CFBundleIdentifier="com.regula.documentreader.qa" version="1.0.0"
|
|
2
|
+
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
|
+
<name>FaceSDK</name>
|
|
4
|
+
<platform name="android">
|
|
5
|
+
<preference name="orientation" value="portrait" />
|
|
6
|
+
<preference name="GradlePluginKotlinEnabled" value="true" />
|
|
7
|
+
<preference name="android-minSdkVersion" value="24" />
|
|
8
|
+
<preference name="android-targetSdkVersion" value="35" />
|
|
9
|
+
<config-file parent="/*" target="AndroidManifest.xml">
|
|
10
|
+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
|
11
|
+
</config-file>
|
|
12
|
+
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
|
|
13
|
+
<application android:usesCleartextTraffic="true" />
|
|
14
|
+
</edit-config>
|
|
15
|
+
</platform>
|
|
16
|
+
<platform name="ios">
|
|
17
|
+
<preference name="orientation" value="portrait" />
|
|
18
|
+
<preference name="DisallowOverscroll" value="true" />
|
|
19
|
+
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
|
|
20
|
+
<string>To use camera</string>
|
|
21
|
+
</config-file>
|
|
22
|
+
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
|
|
23
|
+
<string>To pick images</string>
|
|
24
|
+
</config-file>
|
|
25
|
+
</platform>
|
|
26
|
+
</widget>
|