@authme/liveness 2.7.4 → 2.8.0
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/index.cjs +43 -25
- package/index.js +44 -26
- package/package.json +4 -4
- package/src/lib/data-access/dto.interface.d.ts +9 -6
package/index.cjs
CHANGED
|
@@ -69,8 +69,8 @@ class FasService extends engine.AuthmeEngineModuleBase {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
var name = "authme/sdk";
|
|
72
|
-
var version$1 = "2.
|
|
73
|
-
var date = "
|
|
72
|
+
var version$1 = "2.8.0";
|
|
73
|
+
var date = "2025-01-13T09:38:31+0000";
|
|
74
74
|
var packageInfo = {
|
|
75
75
|
name: name,
|
|
76
76
|
version: version$1,
|
|
@@ -78,18 +78,22 @@ var packageInfo = {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
const init = url => (Immediately, passive, compareCustomerClientId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
+
const body = {
|
|
82
|
+
Immediately,
|
|
83
|
+
passive: passive,
|
|
84
|
+
compareCustomerClientId: compareCustomerClientId,
|
|
85
|
+
clientInfo: {
|
|
86
|
+
os: 'web',
|
|
87
|
+
os_ver: util.osVersion(),
|
|
88
|
+
client_ver: packageInfo.version
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const customParameters = util.Storage.getItem('customParameters');
|
|
92
|
+
if (customParameters) {
|
|
93
|
+
body['customParameters'] = customParameters;
|
|
94
|
+
}
|
|
81
95
|
return core.sendRequest(url, 'POST', {
|
|
82
|
-
body: JSON.stringify(
|
|
83
|
-
Immediately,
|
|
84
|
-
encrypt: true,
|
|
85
|
-
passive: passive,
|
|
86
|
-
compareCustomerClientId: compareCustomerClientId,
|
|
87
|
-
clientInfo: {
|
|
88
|
-
os: 'web',
|
|
89
|
-
os_ver: util.osVersion(),
|
|
90
|
-
client_ver: packageInfo.version
|
|
91
|
-
}
|
|
92
|
-
})
|
|
96
|
+
body: JSON.stringify(body)
|
|
93
97
|
});
|
|
94
98
|
});
|
|
95
99
|
const detect = url => data => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -110,9 +114,10 @@ const detect = url => data => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
110
114
|
});
|
|
111
115
|
});
|
|
112
116
|
const uploadFrameFile = url => data => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
+
var _a;
|
|
113
118
|
const formData = new FormData();
|
|
114
119
|
formData.append('id', data.id);
|
|
115
|
-
formData.append('index', data.index.toString());
|
|
120
|
+
formData.append('index', (_a = data.index) === null || _a === void 0 ? void 0 : _a.toString());
|
|
116
121
|
formData.append('data', util.dataURItoBlob(data.data));
|
|
117
122
|
return core.sendRequest(url, 'POST', {
|
|
118
123
|
body: formData,
|
|
@@ -120,22 +125,35 @@ const uploadFrameFile = url => data => __awaiter(void 0, void 0, void 0, functio
|
|
|
120
125
|
});
|
|
121
126
|
});
|
|
122
127
|
const uploadFrame = url => body => __awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
var _b;
|
|
129
|
+
let encryptApiPath = '';
|
|
130
|
+
if (body.encryptedBase64String) {
|
|
131
|
+
encryptApiPath = `/encrypted`;
|
|
132
|
+
return core.sendRequest(`${url}${encryptApiPath}`, 'POST', {
|
|
133
|
+
body: JSON.stringify(body)
|
|
134
|
+
});
|
|
135
|
+
} else {
|
|
136
|
+
return core.sendRequest(url, 'POST', {
|
|
137
|
+
body: JSON.stringify(Object.assign(Object.assign({}, body), {
|
|
138
|
+
data: (_b = body.data) === null || _b === void 0 ? void 0 : _b.split('base64,')[1]
|
|
139
|
+
}))
|
|
140
|
+
});
|
|
141
|
+
}
|
|
128
142
|
});
|
|
129
143
|
const uploadMeta = url => data => __awaiter(void 0, void 0, void 0, function* () {
|
|
130
|
-
|
|
144
|
+
let encryptApiPath = '';
|
|
145
|
+
if (data.encryptedBase64String) {
|
|
146
|
+
encryptApiPath = `/encrypted`;
|
|
147
|
+
}
|
|
148
|
+
return core.sendRequest(`${url}${encryptApiPath}`, 'POST', {
|
|
131
149
|
body: JSON.stringify(data)
|
|
132
150
|
});
|
|
133
151
|
});
|
|
134
152
|
const getResult = url => id => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
-
return core.sendRequest(`${url}
|
|
153
|
+
return core.sendRequest(`${url}/${id}`, 'GET');
|
|
136
154
|
});
|
|
137
155
|
const getVerifyResult = url => id => __awaiter(void 0, void 0, void 0, function* () {
|
|
138
|
-
return core.sendRequest(`${url}
|
|
156
|
+
return core.sendRequest(`${url}/${id}`, 'GET');
|
|
139
157
|
});
|
|
140
158
|
const IdentityVerification = {
|
|
141
159
|
init: init('/api/identity-verification/v3/liveness/init'),
|
|
@@ -143,10 +161,10 @@ const IdentityVerification = {
|
|
|
143
161
|
uploadFrame: uploadFrame('/api/identity-verification/v3/liveness/frame'),
|
|
144
162
|
uploadFrameFile: uploadFrameFile('/api/identity-verification/v3/liveness/frame-file'),
|
|
145
163
|
uploadMeta: uploadMeta('/api/identity-verification/v3/liveness/meta'),
|
|
146
|
-
getResult: getResult('/api/identity-verification/v3/liveness/result
|
|
164
|
+
getResult: getResult('/api/identity-verification/v3/liveness/result')
|
|
147
165
|
};
|
|
148
166
|
const CustomerManagement = {
|
|
149
|
-
getVerifyResult: getVerifyResult('/api/customer-management/liveness-verify/v3/result
|
|
167
|
+
getVerifyResult: getVerifyResult('/api/customer-management/liveness-verify/v3/result'),
|
|
150
168
|
init: init('/api/customer-management/liveness-verify/v3/init'),
|
|
151
169
|
detect: detect('/api/customer-management/liveness-verify/v3/detect')
|
|
152
170
|
};
|
|
@@ -157,7 +175,7 @@ const LivenessAPI = {
|
|
|
157
175
|
|
|
158
176
|
exports.LivenessResultStatus = void 0;
|
|
159
177
|
(function (LivenessResultStatus) {
|
|
160
|
-
LivenessResultStatus["DONE"] = "
|
|
178
|
+
LivenessResultStatus["DONE"] = "Done";
|
|
161
179
|
LivenessResultStatus["VALIDATING"] = "Validating";
|
|
162
180
|
LivenessResultStatus["UPLOADING"] = "Uploading";
|
|
163
181
|
})(exports.LivenessResultStatus || (exports.LivenessResultStatus = {}));
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { EAuthMeEyeStatus, EAuthMeFASServiceStage, EAuthMeFaceAntiSpoofingStatus
|
|
|
3
3
|
import 'core-js/modules/es.regexp.to-string.js';
|
|
4
4
|
import 'core-js/modules/es.object.assign.js';
|
|
5
5
|
import { sendRequest } from '@authme/core';
|
|
6
|
-
import { osVersion, dataURItoBlob } from '@authme/util';
|
|
6
|
+
import { osVersion, Storage, dataURItoBlob } from '@authme/util';
|
|
7
7
|
import 'core-js/modules/es.symbol.description.js';
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
@@ -66,8 +66,8 @@ class FasService extends AuthmeEngineModuleBase {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
var name = "authme/sdk";
|
|
69
|
-
var version$1 = "2.
|
|
70
|
-
var date = "
|
|
69
|
+
var version$1 = "2.8.0";
|
|
70
|
+
var date = "2025-01-13T09:38:31+0000";
|
|
71
71
|
var packageInfo = {
|
|
72
72
|
name: name,
|
|
73
73
|
version: version$1,
|
|
@@ -75,18 +75,22 @@ var packageInfo = {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
const init = url => (Immediately, passive, compareCustomerClientId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
const body = {
|
|
79
|
+
Immediately,
|
|
80
|
+
passive: passive,
|
|
81
|
+
compareCustomerClientId: compareCustomerClientId,
|
|
82
|
+
clientInfo: {
|
|
83
|
+
os: 'web',
|
|
84
|
+
os_ver: osVersion(),
|
|
85
|
+
client_ver: packageInfo.version
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const customParameters = Storage.getItem('customParameters');
|
|
89
|
+
if (customParameters) {
|
|
90
|
+
body['customParameters'] = customParameters;
|
|
91
|
+
}
|
|
78
92
|
return sendRequest(url, 'POST', {
|
|
79
|
-
body: JSON.stringify(
|
|
80
|
-
Immediately,
|
|
81
|
-
encrypt: true,
|
|
82
|
-
passive: passive,
|
|
83
|
-
compareCustomerClientId: compareCustomerClientId,
|
|
84
|
-
clientInfo: {
|
|
85
|
-
os: 'web',
|
|
86
|
-
os_ver: osVersion(),
|
|
87
|
-
client_ver: packageInfo.version
|
|
88
|
-
}
|
|
89
|
-
})
|
|
93
|
+
body: JSON.stringify(body)
|
|
90
94
|
});
|
|
91
95
|
});
|
|
92
96
|
const detect = url => data => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -107,9 +111,10 @@ const detect = url => data => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
107
111
|
});
|
|
108
112
|
});
|
|
109
113
|
const uploadFrameFile = url => data => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
var _a;
|
|
110
115
|
const formData = new FormData();
|
|
111
116
|
formData.append('id', data.id);
|
|
112
|
-
formData.append('index', data.index.toString());
|
|
117
|
+
formData.append('index', (_a = data.index) === null || _a === void 0 ? void 0 : _a.toString());
|
|
113
118
|
formData.append('data', dataURItoBlob(data.data));
|
|
114
119
|
return sendRequest(url, 'POST', {
|
|
115
120
|
body: formData,
|
|
@@ -117,22 +122,35 @@ const uploadFrameFile = url => data => __awaiter(void 0, void 0, void 0, functio
|
|
|
117
122
|
});
|
|
118
123
|
});
|
|
119
124
|
const uploadFrame = url => body => __awaiter(void 0, void 0, void 0, function* () {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
var _b;
|
|
126
|
+
let encryptApiPath = '';
|
|
127
|
+
if (body.encryptedBase64String) {
|
|
128
|
+
encryptApiPath = `/encrypted`;
|
|
129
|
+
return sendRequest(`${url}${encryptApiPath}`, 'POST', {
|
|
130
|
+
body: JSON.stringify(body)
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
return sendRequest(url, 'POST', {
|
|
134
|
+
body: JSON.stringify(Object.assign(Object.assign({}, body), {
|
|
135
|
+
data: (_b = body.data) === null || _b === void 0 ? void 0 : _b.split('base64,')[1]
|
|
136
|
+
}))
|
|
137
|
+
});
|
|
138
|
+
}
|
|
125
139
|
});
|
|
126
140
|
const uploadMeta = url => data => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
-
|
|
141
|
+
let encryptApiPath = '';
|
|
142
|
+
if (data.encryptedBase64String) {
|
|
143
|
+
encryptApiPath = `/encrypted`;
|
|
144
|
+
}
|
|
145
|
+
return sendRequest(`${url}${encryptApiPath}`, 'POST', {
|
|
128
146
|
body: JSON.stringify(data)
|
|
129
147
|
});
|
|
130
148
|
});
|
|
131
149
|
const getResult = url => id => __awaiter(void 0, void 0, void 0, function* () {
|
|
132
|
-
return sendRequest(`${url}
|
|
150
|
+
return sendRequest(`${url}/${id}`, 'GET');
|
|
133
151
|
});
|
|
134
152
|
const getVerifyResult = url => id => __awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
-
return sendRequest(`${url}
|
|
153
|
+
return sendRequest(`${url}/${id}`, 'GET');
|
|
136
154
|
});
|
|
137
155
|
const IdentityVerification = {
|
|
138
156
|
init: init('/api/identity-verification/v3/liveness/init'),
|
|
@@ -140,10 +158,10 @@ const IdentityVerification = {
|
|
|
140
158
|
uploadFrame: uploadFrame('/api/identity-verification/v3/liveness/frame'),
|
|
141
159
|
uploadFrameFile: uploadFrameFile('/api/identity-verification/v3/liveness/frame-file'),
|
|
142
160
|
uploadMeta: uploadMeta('/api/identity-verification/v3/liveness/meta'),
|
|
143
|
-
getResult: getResult('/api/identity-verification/v3/liveness/result
|
|
161
|
+
getResult: getResult('/api/identity-verification/v3/liveness/result')
|
|
144
162
|
};
|
|
145
163
|
const CustomerManagement = {
|
|
146
|
-
getVerifyResult: getVerifyResult('/api/customer-management/liveness-verify/v3/result
|
|
164
|
+
getVerifyResult: getVerifyResult('/api/customer-management/liveness-verify/v3/result'),
|
|
147
165
|
init: init('/api/customer-management/liveness-verify/v3/init'),
|
|
148
166
|
detect: detect('/api/customer-management/liveness-verify/v3/detect')
|
|
149
167
|
};
|
|
@@ -154,7 +172,7 @@ const LivenessAPI = {
|
|
|
154
172
|
|
|
155
173
|
var LivenessResultStatus;
|
|
156
174
|
(function (LivenessResultStatus) {
|
|
157
|
-
LivenessResultStatus["DONE"] = "
|
|
175
|
+
LivenessResultStatus["DONE"] = "Done";
|
|
158
176
|
LivenessResultStatus["VALIDATING"] = "Validating";
|
|
159
177
|
LivenessResultStatus["UPLOADING"] = "Uploading";
|
|
160
178
|
})(LivenessResultStatus || (LivenessResultStatus = {}));
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authme/liveness",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"core-js": "^3.6.0",
|
|
6
|
-
"@authme/core": "2.
|
|
7
|
-
"@authme/util": "2.
|
|
8
|
-
"@authme/engine": "2.
|
|
6
|
+
"@authme/core": "2.8.0",
|
|
7
|
+
"@authme/util": "2.8.0",
|
|
8
|
+
"@authme/engine": "2.8.0"
|
|
9
9
|
},
|
|
10
10
|
"module": "./index.js",
|
|
11
11
|
"main": "./index.cjs",
|
|
@@ -9,17 +9,20 @@ export interface LivenessDetectBody {
|
|
|
9
9
|
}[];
|
|
10
10
|
}
|
|
11
11
|
export interface LivenessUploadFrameBody {
|
|
12
|
-
id
|
|
13
|
-
index
|
|
14
|
-
data
|
|
12
|
+
id?: string;
|
|
13
|
+
index?: number;
|
|
14
|
+
data?: string;
|
|
15
|
+
encryptedBase64String?: string;
|
|
15
16
|
}
|
|
16
17
|
export interface LivenessUploadMetaBody {
|
|
17
|
-
id
|
|
18
|
-
data
|
|
18
|
+
id?: string;
|
|
19
|
+
data?: string;
|
|
20
|
+
encryptedBase64String?: string;
|
|
19
21
|
}
|
|
20
22
|
export interface LivenessInitResponse {
|
|
21
23
|
id: string;
|
|
22
24
|
expiredIn: number;
|
|
25
|
+
shouldEncrypt?: boolean;
|
|
23
26
|
parameters: {
|
|
24
27
|
fasThreshold: number;
|
|
25
28
|
fasTimeout: number;
|
|
@@ -37,7 +40,7 @@ export interface LivenessResultResponse {
|
|
|
37
40
|
expiryTime: string;
|
|
38
41
|
}
|
|
39
42
|
export declare enum LivenessResultStatus {
|
|
40
|
-
DONE = "
|
|
43
|
+
DONE = "Done",
|
|
41
44
|
VALIDATING = "Validating",
|
|
42
45
|
UPLOADING = "Uploading"
|
|
43
46
|
}
|