@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.
Files changed (173) hide show
  1. package/README.md +3 -2
  2. package/RNFaceSDK.podspec +2 -2
  3. package/android/build.gradle +2 -2
  4. package/android/cordova.gradle +2 -2
  5. package/android/src/main/java/com/regula/plugin/facesdk/JSONConstructor.kt +0 -2
  6. package/android/src/main/java/com/regula/plugin/facesdk/Main.kt +0 -18
  7. package/examples/capacitor/android/app/src/main/AndroidManifest.xml +2 -2
  8. package/examples/capacitor/index.html +7 -2
  9. package/examples/capacitor/package-lock.json +162 -12
  10. package/examples/capacitor/package.json +4 -4
  11. package/examples/capacitor/scripts/setup.sh +2 -4
  12. package/examples/capacitor/src/main.css +6 -60
  13. package/examples/capacitor/src/main.html +1 -1
  14. package/examples/capacitor/src/main.tsx +87 -51
  15. package/examples/cordova/.vscode/launch.json +28 -0
  16. package/examples/cordova/README.md +25 -0
  17. package/examples/cordova/config.xml +26 -0
  18. package/examples/cordova/package-lock.json +1327 -0
  19. package/examples/cordova/package.json +30 -0
  20. package/examples/cordova/scripts/android.sh +8 -0
  21. package/examples/cordova/scripts/ios.sh +8 -0
  22. package/examples/cordova/scripts/setup.sh +8 -0
  23. package/examples/cordova/www/images/logo.png +0 -0
  24. package/examples/cordova/www/index.html +21 -0
  25. package/examples/cordova/www/src/main.css +83 -0
  26. package/examples/cordova/www/src/main.html +25 -0
  27. package/examples/cordova/www/src/main.js +152 -0
  28. package/examples/ionic/README.md +1 -1
  29. package/examples/ionic/angular.json +3 -3
  30. package/examples/ionic/config.xml +2 -4
  31. package/examples/ionic/index.ts +17 -0
  32. package/examples/ionic/package-lock.json +68 -42
  33. package/examples/ionic/package.json +2 -2
  34. package/examples/ionic/src/images/portrait.png +0 -0
  35. package/examples/ionic/src/main.css +6 -60
  36. package/examples/ionic/src/main.html +1 -1
  37. package/examples/ionic/src/{main.tsx → main.ts} +97 -52
  38. package/examples/ionic/tsconfig.json +2 -3
  39. package/examples/react_native/README.md +0 -1
  40. package/examples/react_native/app.config.ts +1 -1
  41. package/examples/react_native/index.tsx +7 -49
  42. package/examples/react_native/package-lock.json +597 -594
  43. package/examples/react_native/package.json +9 -9
  44. package/examples/react_native/src/main.css +6 -60
  45. package/examples/react_native/src/main.html +1 -1
  46. package/examples/react_native/src/main.tsx +77 -54
  47. package/ios/RFSWJSONConstructor.h +1 -0
  48. package/ios/RFSWJSONConstructor.m +14 -5
  49. package/ios/RFSWMain.m +0 -30
  50. package/package.json +1 -1
  51. package/plugin.xml +2 -2
  52. package/www/capacitor/customization/customization_fonts.js +1 -1
  53. package/www/capacitor/customization/customization_images.js +1 -1
  54. package/www/capacitor/customization/font.js +0 -8
  55. package/www/capacitor/detect_faces/detect_face_result.js +0 -12
  56. package/www/capacitor/detect_faces/detect_faces_attribute_result.js +0 -9
  57. package/www/capacitor/detect_faces/detect_faces_backend_exception.js +0 -7
  58. package/www/capacitor/detect_faces/detect_faces_config.js +0 -34
  59. package/www/capacitor/detect_faces/detect_faces_exception.js +0 -8
  60. package/www/capacitor/detect_faces/detect_faces_request.js +0 -22
  61. package/www/capacitor/detect_faces/detect_faces_response.js +0 -9
  62. package/www/capacitor/face_capture/face_capture_config.js +0 -37
  63. package/www/capacitor/face_capture/face_capture_exception.js +0 -7
  64. package/www/capacitor/face_capture/face_capture_image.js +0 -8
  65. package/www/capacitor/face_capture/face_capture_response.js +0 -7
  66. package/www/capacitor/image_params/output_image_crop.js +0 -23
  67. package/www/capacitor/image_params/output_image_params.js +0 -19
  68. package/www/capacitor/image_params/point.js +0 -7
  69. package/www/capacitor/image_params/rect.js +0 -9
  70. package/www/capacitor/image_params/size.js +0 -12
  71. package/www/capacitor/image_quality/image_quality_characteristic.js +0 -22
  72. package/www/capacitor/image_quality/image_quality_range.js +0 -7
  73. package/www/capacitor/image_quality/image_quality_result.js +0 -10
  74. package/www/capacitor/index.js +0 -48
  75. package/www/capacitor/init/face_sdk_version.js +0 -8
  76. package/www/capacitor/init/init_config.js +0 -19
  77. package/www/capacitor/init/init_exception.js +0 -8
  78. package/www/capacitor/init/license_exception.js +0 -7
  79. package/www/capacitor/internal/bridge.js +1 -20
  80. package/www/capacitor/liveness/liveness_backend_exception.js +0 -7
  81. package/www/capacitor/liveness/liveness_config.js +0 -43
  82. package/www/capacitor/liveness/liveness_exception.js +0 -8
  83. package/www/capacitor/liveness/liveness_notification.js +0 -7
  84. package/www/capacitor/liveness/liveness_response.js +0 -11
  85. package/www/capacitor/match_faces/compared_face.js +0 -9
  86. package/www/capacitor/match_faces/compared_faces_pair.js +0 -10
  87. package/www/capacitor/match_faces/compared_faces_split.js +0 -7
  88. package/www/capacitor/match_faces/match_faces_backend_exception.js +0 -7
  89. package/www/capacitor/match_faces/match_faces_config.js +0 -19
  90. package/www/capacitor/match_faces/match_faces_detection.js +0 -9
  91. package/www/capacitor/match_faces/match_faces_detection_face.js +0 -11
  92. package/www/capacitor/match_faces/match_faces_exception.js +0 -8
  93. package/www/capacitor/match_faces/match_faces_image.js +0 -9
  94. package/www/capacitor/match_faces/match_faces_request.js +0 -27
  95. package/www/capacitor/match_faces/match_faces_response.js +0 -9
  96. package/www/capacitor/person_database/edit_group_persons_request.js +0 -15
  97. package/www/capacitor/person_database/image_upload.js +0 -17
  98. package/www/capacitor/person_database/pageable_item_list.js +0 -8
  99. package/www/capacitor/person_database/person.js +0 -13
  100. package/www/capacitor/person_database/person_group.js +0 -11
  101. package/www/capacitor/person_database/person_image.js +0 -13
  102. package/www/capacitor/person_database/search_person.js +0 -14
  103. package/www/capacitor/person_database/search_person_detection.js +0 -9
  104. package/www/capacitor/person_database/search_person_image.js +0 -15
  105. package/www/capacitor/person_database/search_person_request.js +0 -29
  106. package/www/cordova.js +6 -753
  107. package/www/react-native/customization/customization_fonts.js +1 -1
  108. package/www/react-native/customization/customization_images.js +1 -1
  109. package/www/react-native/customization/font.js +0 -8
  110. package/www/react-native/detect_faces/detect_face_result.js +0 -12
  111. package/www/react-native/detect_faces/detect_faces_attribute_result.js +0 -9
  112. package/www/react-native/detect_faces/detect_faces_backend_exception.js +0 -7
  113. package/www/react-native/detect_faces/detect_faces_config.js +0 -34
  114. package/www/react-native/detect_faces/detect_faces_exception.js +0 -8
  115. package/www/react-native/detect_faces/detect_faces_request.js +0 -22
  116. package/www/react-native/detect_faces/detect_faces_response.js +0 -9
  117. package/www/react-native/face_capture/face_capture_config.js +0 -37
  118. package/www/react-native/face_capture/face_capture_exception.js +0 -7
  119. package/www/react-native/face_capture/face_capture_image.js +0 -8
  120. package/www/react-native/face_capture/face_capture_response.js +0 -7
  121. package/www/react-native/image_params/output_image_crop.js +0 -23
  122. package/www/react-native/image_params/output_image_params.js +0 -19
  123. package/www/react-native/image_params/point.js +0 -7
  124. package/www/react-native/image_params/rect.js +0 -9
  125. package/www/react-native/image_params/size.js +0 -12
  126. package/www/react-native/image_quality/image_quality_characteristic.js +0 -22
  127. package/www/react-native/image_quality/image_quality_range.js +0 -7
  128. package/www/react-native/image_quality/image_quality_result.js +0 -10
  129. package/www/react-native/index.js +0 -48
  130. package/www/react-native/init/face_sdk_version.js +0 -8
  131. package/www/react-native/init/init_config.js +0 -19
  132. package/www/react-native/init/init_exception.js +0 -8
  133. package/www/react-native/init/license_exception.js +0 -7
  134. package/www/react-native/internal/bridge.js +1 -20
  135. package/www/react-native/liveness/liveness_backend_exception.js +0 -7
  136. package/www/react-native/liveness/liveness_config.js +0 -43
  137. package/www/react-native/liveness/liveness_exception.js +0 -8
  138. package/www/react-native/liveness/liveness_notification.js +0 -7
  139. package/www/react-native/liveness/liveness_response.js +0 -11
  140. package/www/react-native/match_faces/compared_face.js +0 -9
  141. package/www/react-native/match_faces/compared_faces_pair.js +0 -10
  142. package/www/react-native/match_faces/compared_faces_split.js +0 -7
  143. package/www/react-native/match_faces/match_faces_backend_exception.js +0 -7
  144. package/www/react-native/match_faces/match_faces_config.js +0 -19
  145. package/www/react-native/match_faces/match_faces_detection.js +0 -9
  146. package/www/react-native/match_faces/match_faces_detection_face.js +0 -11
  147. package/www/react-native/match_faces/match_faces_exception.js +0 -8
  148. package/www/react-native/match_faces/match_faces_image.js +0 -9
  149. package/www/react-native/match_faces/match_faces_request.js +0 -27
  150. package/www/react-native/match_faces/match_faces_response.js +0 -9
  151. package/www/react-native/person_database/edit_group_persons_request.js +0 -15
  152. package/www/react-native/person_database/image_upload.js +0 -17
  153. package/www/react-native/person_database/pageable_item_list.js +0 -8
  154. package/www/react-native/person_database/person.js +0 -13
  155. package/www/react-native/person_database/person_group.js +0 -11
  156. package/www/react-native/person_database/person_image.js +0 -13
  157. package/www/react-native/person_database/search_person.js +0 -14
  158. package/www/react-native/person_database/search_person_detection.js +0 -9
  159. package/www/react-native/person_database/search_person_image.js +0 -15
  160. package/www/react-native/person_database/search_person_request.js +0 -29
  161. package/www/types/index.d.ts +0 -12
  162. package/www/types/match_faces/match_faces_config.d.ts +0 -2
  163. package/www/types/person_database/search_person_request.d.ts +0 -4
  164. package/examples/capacitor/index.tsx +0 -53
  165. package/examples/ionic/index.tsx +0 -68
  166. package/test/json.tsx +0 -375
  167. package/test/package-lock.json +0 -584
  168. package/test/package.json +0 -9
  169. package/test/test.tsx +0 -61
  170. package/test/utils.tsx +0 -38
  171. /package/examples/{ionic → cordova/www}/images/portrait.png +0 -0
  172. /package/examples/ionic/{assets → src/assets}/.gitkeep +0 -0
  173. /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
- async function getImage(position: number) {
50
- var source = await chooseOption()
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
- var mfImage = new MatchFacesImage(base64, type)
63
- if (position == 1) {
64
- image1 = mfImage
65
- setUiImage1(base64)
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
- export function main() {
94
- document.getElementById("first-image")!.onclick = () => getImage(1)
95
- document.getElementById("second-image")!.onclick = () => getImage(2)
96
- document.getElementById("match-faces")!.onclick = () => matchFaces()
97
- document.getElementById("start-liveness")!.onclick = () => startLiveness()
98
- document.getElementById("clear-results")!.onclick = () => clearResults()
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
- init()
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
- var setStatus = (data: string) => document.getElementById("status")!.innerHTML = data
104
- var setLivenessStatus = (data: string) => document.getElementById("liveness-status")!.innerHTML = data
105
- var setSimilarityStatus = (data: string) => document.getElementById("similarity-status")!.innerHTML = data
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 clearResults = () => {
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>