@regulaforensics/face-sdk 7.2.404-beta → 7.2.414-beta
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 +2 -3
- package/RNFaceSDK.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/cordova.gradle +2 -2
- package/examples/capacitor/android/app/src/main/AndroidManifest.xml +2 -2
- package/examples/capacitor/index.html +2 -7
- package/examples/capacitor/index.tsx +53 -0
- package/examples/capacitor/package.json +3 -3
- package/examples/capacitor/scripts/setup.sh +4 -2
- package/examples/capacitor/src/main.css +60 -6
- package/examples/capacitor/src/main.html +1 -1
- package/examples/capacitor/src/main.tsx +51 -87
- package/examples/ionic/angular.json +3 -3
- package/examples/ionic/config.xml +1 -1
- package/examples/ionic/index.tsx +68 -0
- package/examples/ionic/package.json +2 -2
- package/examples/ionic/src/main.css +60 -6
- package/examples/ionic/src/main.html +1 -1
- package/examples/ionic/src/{main.ts → main.tsx} +52 -97
- package/examples/ionic/tsconfig.json +3 -2
- package/examples/react_native/index.tsx +49 -7
- package/examples/react_native/package.json +9 -9
- package/examples/react_native/src/main.css +60 -6
- package/examples/react_native/src/main.html +1 -1
- package/examples/react_native/src/main.tsx +54 -77
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/test/package-lock.json +1 -1
- package/examples/cordova/.vscode/launch.json +0 -28
- package/examples/cordova/README.md +0 -25
- package/examples/cordova/config.xml +0 -26
- package/examples/cordova/package-lock.json +0 -1327
- package/examples/cordova/package.json +0 -30
- package/examples/cordova/scripts/android.sh +0 -8
- package/examples/cordova/scripts/ios.sh +0 -8
- package/examples/cordova/scripts/setup.sh +0 -8
- package/examples/cordova/www/images/logo.png +0 -0
- package/examples/cordova/www/index.html +0 -21
- package/examples/cordova/www/src/main.css +0 -83
- package/examples/cordova/www/src/main.html +0 -25
- package/examples/cordova/www/src/main.js +0 -152
- package/examples/ionic/index.ts +0 -17
- package/examples/ionic/src/images/portrait.png +0 -0
- package/examples/react_native/package-lock.json +0 -9296
- /package/examples/ionic/{src/assets → assets}/.gitkeep +0 -0
- /package/examples/ionic/{src/images → images}/icon.png +0 -0
- /package/examples/{cordova/www → ionic}/images/portrait.png +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "face-sdk",
|
|
3
|
-
"scripts": {
|
|
4
|
-
"setup": "scripts/setup.sh",
|
|
5
|
-
"ios": "scripts/ios.sh",
|
|
6
|
-
"android": "scripts/android.sh"
|
|
7
|
-
},
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@regulaforensics/face-sdk": "7.2.404-beta",
|
|
10
|
-
"@regulaforensics/face-core-basic": "7.2.238-rc",
|
|
11
|
-
"cordova-ios": "7.1.1",
|
|
12
|
-
"cordova-android": "13.0.0",
|
|
13
|
-
"cordova-plugin-file": "8.1.3",
|
|
14
|
-
"cordova-plugin-camera": "8.0.0",
|
|
15
|
-
"cordova-plugin-dialogs": "2.0.2"
|
|
16
|
-
},
|
|
17
|
-
"cordova": {
|
|
18
|
-
"plugins": {
|
|
19
|
-
"@regulaforensics/face-sdk": {},
|
|
20
|
-
"@regulaforensics/face-core-basic": {},
|
|
21
|
-
"cordova-plugin-file": {},
|
|
22
|
-
"cordova-plugin-camera": {},
|
|
23
|
-
"cordova-plugin-dialogs": {}
|
|
24
|
-
},
|
|
25
|
-
"platforms": [
|
|
26
|
-
"android",
|
|
27
|
-
"ios"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
Binary file
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<meta name="viewport" content="initial-scale=1, user-scalable=no, viewport-fit=cover">
|
|
2
|
-
<link rel="stylesheet" href="src/main.css">
|
|
3
|
-
<script src="cordova.js"></script>
|
|
4
|
-
<script src="src/main.js"></script>
|
|
5
|
-
|
|
6
|
-
<div id="content" style="height: 100%"></div>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
document.addEventListener('deviceready', () => {
|
|
10
|
-
window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + 'www/src/main.html', (fileEntry) => {
|
|
11
|
-
fileEntry.file((file) => {
|
|
12
|
-
const reader = new FileReader()
|
|
13
|
-
reader.onloadend = function () {
|
|
14
|
-
document.getElementById('content').innerHTML = this.result
|
|
15
|
-
document.dispatchEvent(new CustomEvent("ready"))
|
|
16
|
-
}
|
|
17
|
-
reader.readAsText(file)
|
|
18
|
-
})
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
</script>
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
html,
|
|
2
|
-
body {
|
|
3
|
-
width: 99%;
|
|
4
|
-
height: 99vh;
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.page {
|
|
10
|
-
height: 100%;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.column {
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
align-items: center;
|
|
19
|
-
justify-content: center;
|
|
20
|
-
width: 100%;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.row {
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: row;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.header {
|
|
31
|
-
text-align: center;
|
|
32
|
-
padding-top: 80px;
|
|
33
|
-
margin-top: -10px;
|
|
34
|
-
background-color: rgba(0, 0, 0, 0.03);
|
|
35
|
-
font-weight: 600;
|
|
36
|
-
font-size: 18px;
|
|
37
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.sub-header {
|
|
41
|
-
background-color: rgba(0, 0, 0, 0.03);
|
|
42
|
-
width: 100%;
|
|
43
|
-
padding-top: 13px;
|
|
44
|
-
text-align: center;
|
|
45
|
-
font-weight: 550;
|
|
46
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.divider {
|
|
50
|
-
height: 1px;
|
|
51
|
-
background-color: rgba(0, 0, 0, 0.075);
|
|
52
|
-
margin-top: 13px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.no-scroll {
|
|
56
|
-
flex-grow: 1;
|
|
57
|
-
overflow-y: hidden;
|
|
58
|
-
overflow-x: hidden;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.button {
|
|
62
|
-
width: 175px;
|
|
63
|
-
height: 40px;
|
|
64
|
-
margin: 5px;
|
|
65
|
-
margin-top: 10px;
|
|
66
|
-
background-color: #4285F4;
|
|
67
|
-
color: white;
|
|
68
|
-
border: none;
|
|
69
|
-
padding: 10px 20px;
|
|
70
|
-
font-size: 16px;
|
|
71
|
-
border-radius: 100px;
|
|
72
|
-
cursor: pointer;
|
|
73
|
-
transition: all 0.3s ease;
|
|
74
|
-
user-select: none;
|
|
75
|
-
-webkit-user-select: none;
|
|
76
|
-
-moz-user-select: none;
|
|
77
|
-
-ms-user-select: none;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.button:active {
|
|
81
|
-
position: relative;
|
|
82
|
-
top: 1px;
|
|
83
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<div class="page">
|
|
2
|
-
<div class="column header">
|
|
3
|
-
<span id="status">Loading...</span>
|
|
4
|
-
<div class="column divider"></div>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="column sub-header">
|
|
7
|
-
<div class="row" style="width: 100%">
|
|
8
|
-
<div style="width: 185px">Similarity: <span id="similarity-status">null</span></div>
|
|
9
|
-
<div style="width: 185px">Liveness: <span id="liveness-status">null</span></div>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="column divider"></div>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="column no-scroll">
|
|
14
|
-
<div class="row" style="height: 100%">
|
|
15
|
-
<img id="first-image" src="images/portrait.png" width="175px" style="padding: 5px">
|
|
16
|
-
<img id="second-image" src="images/portrait.png" width="175px" style="padding: 5px">
|
|
17
|
-
</div>
|
|
18
|
-
<div class="row">
|
|
19
|
-
<button id="match-faces" class="button">Match</button>
|
|
20
|
-
<button id="start-liveness" class="button">Liveness</button>
|
|
21
|
-
</div>
|
|
22
|
-
<button id="clear-results" class="button" style="width: 360px">Clear</button>
|
|
23
|
-
<div style="padding-top: 30px"></div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
document.addEventListener('ready', onDeviceReady)
|
|
2
|
-
async function onDeviceReady() {
|
|
3
|
-
faceSdk = FaceSDKPlugin.FaceSDK.instance
|
|
4
|
-
|
|
5
|
-
image1 = null
|
|
6
|
-
image2 = null
|
|
7
|
-
|
|
8
|
-
// imports
|
|
9
|
-
FaceCaptureResponse = FaceSDKPlugin.FaceCaptureResponse
|
|
10
|
-
LivenessResponse = FaceSDKPlugin.LivenessResponse
|
|
11
|
-
MatchFacesResponse = FaceSDKPlugin.MatchFacesResponse
|
|
12
|
-
MatchFacesRequest = FaceSDKPlugin.MatchFacesRequest
|
|
13
|
-
MatchFacesImage = FaceSDKPlugin.MatchFacesImage
|
|
14
|
-
ComparedFacesSplit = FaceSDKPlugin.ComparedFacesSplit
|
|
15
|
-
InitConfig = FaceSDKPlugin.InitConfig
|
|
16
|
-
InitResponse = FaceSDKPlugin.InitResponse
|
|
17
|
-
LivenessNotification = FaceSDKPlugin.LivenessNotification
|
|
18
|
-
ImageType = FaceSDKPlugin.ImageType
|
|
19
|
-
LivenessSkipStep = FaceSDKPlugin.LivenessSkipStep
|
|
20
|
-
LivenessStatus = FaceSDKPlugin.LivenessStatus
|
|
21
|
-
LivenessConfig = FaceSDKPlugin.LivenessConfig
|
|
22
|
-
|
|
23
|
-
setStatus = data => document.getElementById("status").innerHTML = data
|
|
24
|
-
setLivenessStatus = data => document.getElementById("liveness-status").innerHTML = data
|
|
25
|
-
setSimilarityStatus = data => document.getElementById("similarity-status").innerHTML = data
|
|
26
|
-
setUiImage1 = data => document.getElementById("first-image").src = data
|
|
27
|
-
setUiImage2 = data => document.getElementById("second-image").src = data
|
|
28
|
-
resetImages = () => {
|
|
29
|
-
setUiImage1("images/portrait.png")
|
|
30
|
-
setUiImage2("images/portrait.png")
|
|
31
|
-
}
|
|
32
|
-
document.getElementById("first-image").onclick = () => pickImage(1)
|
|
33
|
-
document.getElementById("second-image").onclick = () => pickImage(2)
|
|
34
|
-
document.getElementById("match-faces").onclick = () => matchFaces()
|
|
35
|
-
document.getElementById("start-liveness").onclick = () => startLiveness()
|
|
36
|
-
document.getElementById("clear-results").onclick = () => clearResults()
|
|
37
|
-
|
|
38
|
-
init()
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async function init() {
|
|
42
|
-
if (!await initialize()) return
|
|
43
|
-
setStatus("Ready")
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function startLiveness() {
|
|
47
|
-
var response = await faceSdk.startLiveness({
|
|
48
|
-
config: new LivenessConfig({
|
|
49
|
-
skipStep: [LivenessSkipStep.ONBOARDING_STEP]
|
|
50
|
-
}),
|
|
51
|
-
notificationCompletion: (notification) => {
|
|
52
|
-
console.log("LivenessStatus: " + notification.status)
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
if (response.image == null) return
|
|
56
|
-
setImage("data:image/png;base64," + response.image, ImageType.LIVE, 1)
|
|
57
|
-
setLivenessStatus(response.liveness == LivenessStatus.PASSED ? "passed" : "unknown")
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function matchFaces() {
|
|
61
|
-
if (image1 == null || image2 == null) {
|
|
62
|
-
setStatus("Both images required!")
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
setStatus("Processing...")
|
|
66
|
-
var request = new MatchFacesRequest([image1, image2])
|
|
67
|
-
var response = await faceSdk.matchFaces(request)
|
|
68
|
-
var split = await faceSdk.splitComparedFaces(response.results, 0.75)
|
|
69
|
-
var match = split.matchedFaces
|
|
70
|
-
setSimilarityStatus("failed")
|
|
71
|
-
if (match.length > 0)
|
|
72
|
-
setSimilarityStatus((match[0].similarity * 100).toFixed(2) + "%")
|
|
73
|
-
setStatus("Ready")
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function clearResults() {
|
|
77
|
-
setStatus("Ready")
|
|
78
|
-
setSimilarityStatus("null")
|
|
79
|
-
setLivenessStatus("null")
|
|
80
|
-
resetImages()
|
|
81
|
-
image1 = null
|
|
82
|
-
image2 = null
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// If 'regula.license' exists, init using license(enables offline match)
|
|
86
|
-
// otherwise init without license.
|
|
87
|
-
async function initialize() {
|
|
88
|
-
setStatus("Initializing...")
|
|
89
|
-
|
|
90
|
-
var license = await loadAssetIfExists("regula.license")
|
|
91
|
-
var config
|
|
92
|
-
if (license != null) config = new InitConfig(license)
|
|
93
|
-
var [success, error] = await faceSdk.initialize({ config: config })
|
|
94
|
-
|
|
95
|
-
if (!success && error != null) {
|
|
96
|
-
setStatus(error.message)
|
|
97
|
-
console.log(error.code + ": " + error.message)
|
|
98
|
-
}
|
|
99
|
-
return success
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function setImage(base64, type, position) {
|
|
103
|
-
setSimilarityStatus("null")
|
|
104
|
-
var mfImage = new MatchFacesImage(base64, type)
|
|
105
|
-
if (position == 1) {
|
|
106
|
-
image1 = mfImage
|
|
107
|
-
setUiImage1(base64)
|
|
108
|
-
setLivenessStatus("null")
|
|
109
|
-
}
|
|
110
|
-
if (position == 2) {
|
|
111
|
-
image2 = mfImage
|
|
112
|
-
setUiImage2(base64)
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async function useCamera(position) {
|
|
117
|
-
var response = await faceSdk.startFaceCapture()
|
|
118
|
-
if (response.image == null) return
|
|
119
|
-
var image = response.image
|
|
120
|
-
setImage("data:image/png;base64," + image.image, image.imageType, position)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function useGallery(position) {
|
|
124
|
-
navigator.camera.getPicture(function (result) {
|
|
125
|
-
if (result == null) return
|
|
126
|
-
setImage(result, ImageType.PRINTED, position)
|
|
127
|
-
}, function (_) { }, {
|
|
128
|
-
destinationType: Camera.DestinationType.DATA_URL,
|
|
129
|
-
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
|
|
130
|
-
mediaType: Camera.MediaType.PICTURE
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function pickImage(position) {
|
|
135
|
-
navigator.notification.confirm("", button => {
|
|
136
|
-
if (button == 1) useGallery(position)
|
|
137
|
-
else useCamera(position)
|
|
138
|
-
}, "Select option", ["Use gallery", "Use camera"])
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
async function loadAssetIfExists(path) {
|
|
142
|
-
path = cordova.file.applicationDirectory + "www/" + path
|
|
143
|
-
return new Promise((resolve, _) => {
|
|
144
|
-
window.resolveLocalFileSystemURL(path, (fileEntry) => {
|
|
145
|
-
fileEntry.file((file) => {
|
|
146
|
-
var reader = new FileReader()
|
|
147
|
-
reader.onloadend = function (_) { resolve(this.result) }
|
|
148
|
-
reader.readAsDataURL(file)
|
|
149
|
-
})
|
|
150
|
-
}, (_) => resolve(null))
|
|
151
|
-
})
|
|
152
|
-
}
|
package/examples/ionic/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import 'zone.js';
|
|
2
|
-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
|
3
|
-
import { BrowserModule } from '@angular/platform-browser'
|
|
4
|
-
import { IonicModule, Platform } from '@ionic/angular'
|
|
5
|
-
import { Dialogs } from '@awesome-cordova-plugins/dialogs/ngx'
|
|
6
|
-
import { Camera } from '@awesome-cordova-plugins/camera/ngx'
|
|
7
|
-
import { Main } from './src/main'
|
|
8
|
-
import { NgModule } from '@angular/core'
|
|
9
|
-
|
|
10
|
-
@NgModule({
|
|
11
|
-
bootstrap: [Main],
|
|
12
|
-
providers: [Platform, Dialogs, Camera],
|
|
13
|
-
imports: [BrowserModule, IonicModule.forRoot()]
|
|
14
|
-
})
|
|
15
|
-
class MainModule { }
|
|
16
|
-
|
|
17
|
-
platformBrowserDynamic().bootstrapModule(MainModule)
|
|
Binary file
|