biometry-sdk 1.2.7 → 1.3.1
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 +135 -109
- package/dist/biometry-sdk.esm.js +184 -75
- package/dist/components/biometry-enrollment.d.ts +26 -0
- package/dist/components/biometry-onboarding.d.ts +1 -26
- package/dist/components/biometry-onboarding.js +233 -0
- package/dist/components/types.d.ts +12 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -0
- package/dist/sdk.d.ts +98 -22
- package/dist/sdk.js +179 -0
- package/dist/sdk.test.js +255 -0
- package/dist/types/biometry/consent.d.ts +4 -0
- package/dist/types/biometry/doc-auth.d.ts +24 -0
- package/dist/types/biometry/enrollment.d.ts +40 -0
- package/dist/types/biometry/face-match.d.ts +13 -0
- package/dist/types/biometry/process-video.d.ts +32 -0
- package/dist/types/biometry/session.d.ts +4 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/internal.d.ts +4 -0
- package/dist/types.js +14 -0
- package/package.json +11 -5
package/dist/biometry-sdk.esm.js
CHANGED
|
@@ -24,17 +24,41 @@ class BiometrySDK {
|
|
|
24
24
|
const errorMessage = (errorData === null || errorData === undefined ? undefined : errorData.error) || (errorData === null || errorData === undefined ? undefined : errorData.message) || 'Unknown error occurred';
|
|
25
25
|
throw new Error(`Error ${response.status}: ${errorMessage}`);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
// Extract response headers
|
|
28
|
+
const responseHeaders = {};
|
|
29
|
+
const requestId = response.headers.get("X-Request-Id");
|
|
30
|
+
if (requestId) {
|
|
31
|
+
responseHeaders["X-Request-Id"] = requestId;
|
|
32
|
+
}
|
|
33
|
+
const responseBody = await response.json();
|
|
34
|
+
return {
|
|
35
|
+
body: responseBody,
|
|
36
|
+
headers: responseHeaders
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Starts a new Session for a user.
|
|
41
|
+
*
|
|
42
|
+
* @returns {Promise<ApiResponse<SessionResponse>>} A promise resolving to the session ID.
|
|
43
|
+
* @throws {Error} - If the request fails.
|
|
44
|
+
*/
|
|
45
|
+
async startSession() {
|
|
46
|
+
return await this.request('/api-gateway/sessions/start', 'POST');
|
|
28
47
|
}
|
|
29
48
|
/**
|
|
30
|
-
* Submits consent for a user.
|
|
49
|
+
* Submits Authorization consent for a user.
|
|
50
|
+
* Authorization Consent is required to use the services like Face and Voice recognition.
|
|
31
51
|
*
|
|
32
52
|
* @param {boolean} isConsentGiven - Indicates whether the user has given consent.
|
|
33
53
|
* @param {string} userFullName - The full name of the user giving consent.
|
|
34
|
-
* @
|
|
54
|
+
* @param {Object} [props] - Optional properties for the consent request.
|
|
55
|
+
* @param {string} [props.sessionId] - Session ID to link this consent with a specific session group.
|
|
56
|
+
* @param {object} [props.deviceInfo] - Device information object containing details about the user's device.
|
|
57
|
+
* This can include properties like operating system, browser, etc.
|
|
58
|
+
* @returns {Promise<ApiResponse<ConsentResponse>>} A promise resolving to the consent response.
|
|
35
59
|
* @throws {Error} - If the user's full name is not provided or if the request fails.
|
|
36
60
|
*/
|
|
37
|
-
async
|
|
61
|
+
async giveAuthorizationConsent(isConsentGiven, userFullName, props) {
|
|
38
62
|
if (!userFullName) {
|
|
39
63
|
throw new Error('User Full Name is required to give consent.');
|
|
40
64
|
}
|
|
@@ -42,24 +66,60 @@ class BiometrySDK {
|
|
|
42
66
|
is_consent_given: isConsentGiven,
|
|
43
67
|
user_fullname: userFullName,
|
|
44
68
|
};
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
69
|
+
const headers = {};
|
|
70
|
+
if (props === null || props === undefined ? undefined : props.sessionId) {
|
|
71
|
+
headers['X-Session-ID'] = props.sessionId;
|
|
72
|
+
}
|
|
73
|
+
if (props === null || props === undefined ? undefined : props.deviceInfo) {
|
|
74
|
+
headers['X-Device-Info'] = JSON.stringify(props.deviceInfo);
|
|
75
|
+
}
|
|
76
|
+
return await this.request('/api-consent/consent', 'POST', body, headers);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Submits Storage consent for a user.
|
|
80
|
+
* Storage consent is granted by users, allowing us to store their biometric data for future verification.
|
|
81
|
+
*
|
|
82
|
+
* @param {boolean} isStorageConsentGiven - Indicates whether the user has given storage consent.
|
|
83
|
+
* @param {string} userFullName - The full name of the user giving storage consent.
|
|
84
|
+
* @param {Object} [props] - Optional properties for the consent request.
|
|
85
|
+
* @param {string} [props.sessionId] - Session ID to link this consent with a specific session group.
|
|
86
|
+
* @param {object} [props.deviceInfo] - Device information object containing details about the user's device.
|
|
87
|
+
* This can include properties like operating system, browser, etc.
|
|
88
|
+
* @returns {Promise<ApiResponse<ConsentResponse>>} A promise resolving to the consent response.
|
|
89
|
+
* @throws {Error} - If the user's full name is not provided or if the request fails.
|
|
90
|
+
*/
|
|
91
|
+
async giveStorageConsent(isStorageConsentGiven, userFullName, props) {
|
|
92
|
+
if (!userFullName) {
|
|
93
|
+
throw new Error('User Full Name is required to give storage consent.');
|
|
94
|
+
}
|
|
95
|
+
const body = {
|
|
96
|
+
is_consent_given: isStorageConsentGiven,
|
|
97
|
+
user_fullname: userFullName,
|
|
49
98
|
};
|
|
99
|
+
const headers = {};
|
|
100
|
+
if (props === null || props === undefined ? undefined : props.sessionId) {
|
|
101
|
+
headers['X-Session-ID'] = props.sessionId;
|
|
102
|
+
}
|
|
103
|
+
if (props === null || props === undefined ? undefined : props.deviceInfo) {
|
|
104
|
+
headers['X-Device-Info'] = JSON.stringify(props.deviceInfo);
|
|
105
|
+
}
|
|
106
|
+
return await this.request('/api-consent/strg-consent', 'POST', body, headers);
|
|
50
107
|
}
|
|
51
108
|
/**
|
|
52
|
-
*
|
|
109
|
+
* Enrolls a user's voice for biometric authentication.
|
|
53
110
|
*
|
|
54
111
|
* @param {File} audio - The audio file containing the user's voice.
|
|
55
|
-
* @param {string} userFullName - The full name of the user being
|
|
56
|
-
* @param {string} uniqueId - A unique identifier for the
|
|
112
|
+
* @param {string} userFullName - The full name of the user being enrolled.
|
|
113
|
+
* @param {string} uniqueId - A unique identifier for the enrolling process.
|
|
57
114
|
* @param {string} phrase - The phrase spoken in the audio file.
|
|
58
|
-
* @param {
|
|
59
|
-
* @
|
|
115
|
+
* @param {Object} [props] - Optional properties for the enrollment request.
|
|
116
|
+
* @param {string} [props.sessionId] - Session ID to link this enrollment with a specific session group.
|
|
117
|
+
* @param {object} [props.deviceInfo] - Device information object containing details about the user's device.
|
|
118
|
+
* This can include properties like operating system, browser, etc.
|
|
119
|
+
* @returns {Promise<ApiResponse<VoiceEnrollmentResponse>>} - A promise resolving to the voice enrolling response.
|
|
60
120
|
* @throws {Error} - If required parameters are missing or the request fails.
|
|
61
121
|
*/
|
|
62
|
-
async
|
|
122
|
+
async enrollVoice(audio, userFullName, uniqueId, phrase, props) {
|
|
63
123
|
if (!userFullName)
|
|
64
124
|
throw new Error('User fullname is required.');
|
|
65
125
|
if (!uniqueId)
|
|
@@ -75,22 +135,28 @@ class BiometrySDK {
|
|
|
75
135
|
const headers = {
|
|
76
136
|
'X-User-Fullname': userFullName,
|
|
77
137
|
};
|
|
78
|
-
if (
|
|
79
|
-
headers['X-
|
|
138
|
+
if (props === null || props === undefined ? undefined : props.sessionId) {
|
|
139
|
+
headers['X-Session-ID'] = props.sessionId;
|
|
80
140
|
}
|
|
81
|
-
|
|
141
|
+
if (props === null || props === undefined ? undefined : props.deviceInfo) {
|
|
142
|
+
headers['X-Device-Info'] = JSON.stringify(props.deviceInfo);
|
|
143
|
+
}
|
|
144
|
+
return await this.request('/api-gateway/enroll/voice', 'POST', formData, headers);
|
|
82
145
|
}
|
|
83
146
|
/**
|
|
84
|
-
*
|
|
147
|
+
* Enrolls a user's face for biometric authentication.
|
|
85
148
|
*
|
|
86
149
|
* @param {File} face - Image file that contains user's face.
|
|
87
|
-
* @param {string} userFullName - The full name of the user being
|
|
150
|
+
* @param {string} userFullName - The full name of the user being enrolled.
|
|
88
151
|
* @param {string} isDocument - Indicates whether the image is a document.
|
|
89
|
-
* @param {
|
|
90
|
-
* @
|
|
152
|
+
* @param {Object} [props] - Optional properties for the enrollment request.
|
|
153
|
+
* @param {string} [props.sessionId] - Session ID to link this enrollment with a specific session group.
|
|
154
|
+
* @param {object} [props.deviceInfo] - Device information object containing details about the user's device.
|
|
155
|
+
* This can include properties like operating system, browser, etc.
|
|
156
|
+
* @returns {Promise<ApiResponse<FaceEnrollmentResponse>>} - A promise resolving to the voice enrolling response.
|
|
91
157
|
* @throws {Error} - If required parameters are missing or the request fails.
|
|
92
158
|
*/
|
|
93
|
-
async
|
|
159
|
+
async enrollFace(face, userFullName, isDocument, props) {
|
|
94
160
|
if (!userFullName)
|
|
95
161
|
throw new Error('User fullname is required.');
|
|
96
162
|
if (!face)
|
|
@@ -103,10 +169,42 @@ class BiometrySDK {
|
|
|
103
169
|
const headers = {
|
|
104
170
|
'X-User-Fullname': userFullName,
|
|
105
171
|
};
|
|
106
|
-
if (
|
|
107
|
-
headers['X-
|
|
172
|
+
if (props === null || props === undefined ? undefined : props.sessionId) {
|
|
173
|
+
headers['X-Session-ID'] = props.sessionId;
|
|
174
|
+
}
|
|
175
|
+
if (props === null || props === undefined ? undefined : props.deviceInfo) {
|
|
176
|
+
headers['X-Device-Info'] = JSON.stringify(props.deviceInfo);
|
|
108
177
|
}
|
|
109
|
-
return this.request('/api-gateway/
|
|
178
|
+
return await this.request('/api-gateway/enroll/face', 'POST', formData, headers);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Check the validity of a documents.
|
|
182
|
+
*
|
|
183
|
+
* @param {File} document - Document image file.
|
|
184
|
+
* @param {string} userFullName - The full name of the user being checked.
|
|
185
|
+
* @param {Object} [props] - Optional properties for the enrollment request.
|
|
186
|
+
* @param {string} [props.sessionId] - Session ID to link this enrollment with a specific session group.
|
|
187
|
+
* @param {object} [props.deviceInfo] - Device information object containing details about the user's device.
|
|
188
|
+
* This can include properties like operating system, browser, etc.
|
|
189
|
+
* @returns {Promise<ApiResponse<DocAuthInfo>>} - A promise resolving to the document authentication information.
|
|
190
|
+
*/
|
|
191
|
+
async checkDocAuth(document, userFullName, props) {
|
|
192
|
+
if (!document)
|
|
193
|
+
throw new Error('Document image is required.');
|
|
194
|
+
if (!userFullName)
|
|
195
|
+
throw new Error('User fullname is required.');
|
|
196
|
+
const formData = new FormData();
|
|
197
|
+
formData.append('document', document);
|
|
198
|
+
const headers = {
|
|
199
|
+
'X-User-Fullname': userFullName,
|
|
200
|
+
};
|
|
201
|
+
if (props === null || props === undefined ? undefined : props.sessionId) {
|
|
202
|
+
headers['X-Session-ID'] = props.sessionId;
|
|
203
|
+
}
|
|
204
|
+
if (props === null || props === undefined ? undefined : props.deviceInfo) {
|
|
205
|
+
headers['X-Device-Info'] = JSON.stringify(props.deviceInfo);
|
|
206
|
+
}
|
|
207
|
+
return await this.request('/api-gateway/check-doc-auth', 'POST', formData, headers);
|
|
110
208
|
}
|
|
111
209
|
/**
|
|
112
210
|
* Matches a user's face from video against a reference image.
|
|
@@ -116,11 +214,14 @@ class BiometrySDK {
|
|
|
116
214
|
* @param {string} userFullName - Pass the full name of end-user to process Voice and Face recognition services.
|
|
117
215
|
* @param {string} processVideoRequestId - ID from the response header of /process-video endpoint.
|
|
118
216
|
* @param {boolean} usePrefilledVideo - Pass true to use the video from the process-video endpoint.
|
|
119
|
-
* @param {
|
|
120
|
-
* @
|
|
217
|
+
* @param {Object} [props] - Optional properties for the enrollment request.
|
|
218
|
+
* @param {string} [props.sessionId] - Session ID to link this enrollment with a specific session group.
|
|
219
|
+
* @param {object} [props.deviceInfo] - Device information object containing details about the user's device.
|
|
220
|
+
* This can include properties like operating system, browser, etc.
|
|
221
|
+
* @returns {Promise<FaceMatchResponse>} - A promise resolving to the voice enrolling response.
|
|
121
222
|
* @throws {Error} - If required parameters are missing or the request fails.
|
|
122
223
|
*/
|
|
123
|
-
async matchFaces(image, video, userFullName, processVideoRequestId, usePrefilledVideo,
|
|
224
|
+
async matchFaces(image, video, userFullName, processVideoRequestId, usePrefilledVideo, props) {
|
|
124
225
|
if (!image)
|
|
125
226
|
throw new Error('Face image is required.');
|
|
126
227
|
if ((!processVideoRequestId && !usePrefilledVideo) && !video)
|
|
@@ -140,10 +241,16 @@ class BiometrySDK {
|
|
|
140
241
|
if (processVideoRequestId && usePrefilledVideo) {
|
|
141
242
|
headers['X-Use-Prefilled-Video'] = 'true';
|
|
142
243
|
}
|
|
143
|
-
if (
|
|
144
|
-
headers['X-
|
|
244
|
+
if (props === null || props === undefined ? undefined : props.sessionId) {
|
|
245
|
+
headers['X-Session-ID'] = props.sessionId;
|
|
246
|
+
}
|
|
247
|
+
if (props === null || props === undefined ? undefined : props.deviceInfo) {
|
|
248
|
+
headers['X-Device-Info'] = JSON.stringify(props.deviceInfo);
|
|
249
|
+
}
|
|
250
|
+
if (props === null || props === undefined ? undefined : props.deviceInfo) {
|
|
251
|
+
headers['X-Device-Info'] = JSON.stringify(props.deviceInfo);
|
|
145
252
|
}
|
|
146
|
-
return this.request('/api-gateway/match-faces', 'POST', formData, headers);
|
|
253
|
+
return await this.request('/api-gateway/match-faces', 'POST', formData, headers);
|
|
147
254
|
}
|
|
148
255
|
/**
|
|
149
256
|
* Process the video through Biometry services to check liveness and authorize user
|
|
@@ -151,11 +258,13 @@ class BiometrySDK {
|
|
|
151
258
|
* @param {File} video - Video file that you want to process.
|
|
152
259
|
* @param {string} phrase - Set of numbers that user needs to say out loud in the video.
|
|
153
260
|
* @param {string} userFullName - Pass the full name of end-user to process Voice and Face recognition services.
|
|
154
|
-
* @param {
|
|
155
|
-
* @param {
|
|
156
|
-
* @
|
|
261
|
+
* @param {Object} [props] - Optional properties for the enrollment request.
|
|
262
|
+
* @param {string} [props.sessionId] - Session ID to link this enrollment with a specific session group.
|
|
263
|
+
* @param {object} [props.deviceInfo] - Device information object containing details about the user's device.
|
|
264
|
+
* This can include properties like operating system, browser, etc.
|
|
265
|
+
* @returns {Promise<ApiResponse<ProcessVideoResponse>>} - A promise resolving to the process video response.
|
|
157
266
|
*/
|
|
158
|
-
async processVideo(video, phrase, userFullName,
|
|
267
|
+
async processVideo(video, phrase, userFullName, props) {
|
|
159
268
|
if (!video)
|
|
160
269
|
throw new Error('Video is required.');
|
|
161
270
|
if (!phrase)
|
|
@@ -167,33 +276,33 @@ class BiometrySDK {
|
|
|
167
276
|
if (userFullName) {
|
|
168
277
|
headers['X-User-Fullname'] = userFullName;
|
|
169
278
|
}
|
|
170
|
-
if (
|
|
171
|
-
headers['X-
|
|
279
|
+
if (props === null || props === undefined ? undefined : props.sessionId) {
|
|
280
|
+
headers['X-Session-ID'] = props.sessionId;
|
|
172
281
|
}
|
|
173
|
-
if (deviceInfo) {
|
|
174
|
-
headers['X-Device-Info'] = JSON.stringify(deviceInfo);
|
|
282
|
+
if (props === null || props === undefined ? undefined : props.deviceInfo) {
|
|
283
|
+
headers['X-Device-Info'] = JSON.stringify(props.deviceInfo);
|
|
175
284
|
}
|
|
176
|
-
return this.request('/api-gateway/process-video', 'POST', formData, headers);
|
|
285
|
+
return await this.request('/api-gateway/process-video', 'POST', formData, headers);
|
|
177
286
|
}
|
|
178
287
|
}
|
|
179
|
-
BiometrySDK.BASE_URL = 'https://api.biometrysolutions.com';
|
|
288
|
+
BiometrySDK.BASE_URL = 'https://api.biometrysolutions.com'; //'https://dev-console.biometrysolutions.com';
|
|
180
289
|
|
|
181
290
|
var BiometryAttributes;
|
|
182
291
|
(function (BiometryAttributes) {
|
|
183
292
|
BiometryAttributes["ApiKey"] = "api-key";
|
|
184
293
|
BiometryAttributes["UserFullname"] = "user-fullname";
|
|
185
294
|
})(BiometryAttributes || (BiometryAttributes = {}));
|
|
186
|
-
var
|
|
187
|
-
(function (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
})(
|
|
295
|
+
var BiometryEnrollmentState;
|
|
296
|
+
(function (BiometryEnrollmentState) {
|
|
297
|
+
BiometryEnrollmentState["Loading"] = "loading";
|
|
298
|
+
BiometryEnrollmentState["Success"] = "success";
|
|
299
|
+
BiometryEnrollmentState["ErrorNoFace"] = "error-no-face";
|
|
300
|
+
BiometryEnrollmentState["ErrorMultipleFaces"] = "error-multiple-faces";
|
|
301
|
+
BiometryEnrollmentState["ErrorNotCentered"] = "error-not-centered";
|
|
302
|
+
BiometryEnrollmentState["ErrorOther"] = "error-other";
|
|
303
|
+
})(BiometryEnrollmentState || (BiometryEnrollmentState = {}));
|
|
195
304
|
|
|
196
|
-
class
|
|
305
|
+
class BiometryEnrollment extends HTMLElement {
|
|
197
306
|
constructor() {
|
|
198
307
|
super();
|
|
199
308
|
this.videoElement = null;
|
|
@@ -244,12 +353,12 @@ class BiometryOnboarding extends HTMLElement {
|
|
|
244
353
|
validateAttributes() {
|
|
245
354
|
if (!this.apiKey) {
|
|
246
355
|
console.error("API key is required.");
|
|
247
|
-
this.toggleState(
|
|
356
|
+
this.toggleState(BiometryEnrollmentState.ErrorOther);
|
|
248
357
|
return;
|
|
249
358
|
}
|
|
250
359
|
if (!this.userFullname) {
|
|
251
360
|
console.error("User fullname is required.");
|
|
252
|
-
this.toggleState(
|
|
361
|
+
this.toggleState(BiometryEnrollmentState.ErrorOther);
|
|
253
362
|
return;
|
|
254
363
|
}
|
|
255
364
|
}
|
|
@@ -308,18 +417,18 @@ class BiometryOnboarding extends HTMLElement {
|
|
|
308
417
|
this.sdk = new BiometrySDK(this.apiKey);
|
|
309
418
|
}
|
|
310
419
|
else {
|
|
311
|
-
this.toggleState(
|
|
420
|
+
this.toggleState(BiometryEnrollmentState.ErrorOther);
|
|
312
421
|
console.error("API key is required to initialize the SDK.");
|
|
313
422
|
}
|
|
314
423
|
}
|
|
315
424
|
toggleState(state) {
|
|
316
425
|
const slots = [
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
426
|
+
BiometryEnrollmentState.Loading,
|
|
427
|
+
BiometryEnrollmentState.Success,
|
|
428
|
+
BiometryEnrollmentState.ErrorNoFace,
|
|
429
|
+
BiometryEnrollmentState.ErrorMultipleFaces,
|
|
430
|
+
BiometryEnrollmentState.ErrorNotCentered,
|
|
431
|
+
BiometryEnrollmentState.ErrorOther,
|
|
323
432
|
];
|
|
324
433
|
slots.forEach((slotName) => {
|
|
325
434
|
const slot = this.shadow.querySelector(`slot[name="${slotName}"]`);
|
|
@@ -379,51 +488,51 @@ class BiometryOnboarding extends HTMLElement {
|
|
|
379
488
|
try {
|
|
380
489
|
if (!blob) {
|
|
381
490
|
console.error("Failed to capture photo.");
|
|
382
|
-
this.toggleState(
|
|
491
|
+
this.toggleState(BiometryEnrollmentState.ErrorOther);
|
|
383
492
|
return;
|
|
384
493
|
}
|
|
385
494
|
const file = new File([blob], "onboard-face.jpg", { type: "image/jpeg" });
|
|
386
495
|
try {
|
|
387
|
-
const response = await this.sdk.
|
|
388
|
-
const result = response.data.
|
|
496
|
+
const response = await this.sdk.enrollFace(file, this.userFullname);
|
|
497
|
+
const result = response.body.data.enroll_result;
|
|
389
498
|
this.resultCode = result === null || result === void 0 ? void 0 : result.code;
|
|
390
499
|
this.description = (result === null || result === void 0 ? void 0 : result.description) || "Unknown error occurred.";
|
|
391
500
|
switch (this.resultCode) {
|
|
392
501
|
case 0:
|
|
393
|
-
this.toggleState(
|
|
502
|
+
this.toggleState(BiometryEnrollmentState.Success);
|
|
394
503
|
break;
|
|
395
504
|
case 1:
|
|
396
|
-
this.toggleState(
|
|
505
|
+
this.toggleState(BiometryEnrollmentState.ErrorNoFace);
|
|
397
506
|
break;
|
|
398
507
|
case 2:
|
|
399
|
-
this.toggleState(
|
|
508
|
+
this.toggleState(BiometryEnrollmentState.ErrorMultipleFaces);
|
|
400
509
|
break;
|
|
401
510
|
case 3:
|
|
402
|
-
this.toggleState(
|
|
511
|
+
this.toggleState(BiometryEnrollmentState.ErrorNotCentered);
|
|
403
512
|
break;
|
|
404
513
|
default:
|
|
405
|
-
this.toggleState(
|
|
514
|
+
this.toggleState(BiometryEnrollmentState.ErrorOther);
|
|
406
515
|
}
|
|
407
|
-
console.log("
|
|
516
|
+
console.log("Enrollment result:", result);
|
|
408
517
|
}
|
|
409
518
|
catch (error) {
|
|
410
|
-
console.error("Error
|
|
411
|
-
this.toggleState(
|
|
519
|
+
console.error("Error enrolling face:", error);
|
|
520
|
+
this.toggleState(BiometryEnrollmentState.ErrorOther);
|
|
412
521
|
}
|
|
413
522
|
}
|
|
414
523
|
catch (error) {
|
|
415
524
|
console.error("Error in toBlob callback:", error);
|
|
416
|
-
this.toggleState(
|
|
525
|
+
this.toggleState(BiometryEnrollmentState.ErrorOther);
|
|
417
526
|
}
|
|
418
527
|
}, "image/jpeg");
|
|
419
528
|
}
|
|
420
529
|
catch (error) {
|
|
421
530
|
console.error("Error capturing photo:", error);
|
|
422
|
-
this.toggleState(
|
|
531
|
+
this.toggleState(BiometryEnrollmentState.ErrorOther);
|
|
423
532
|
}
|
|
424
533
|
}
|
|
425
534
|
}
|
|
426
|
-
customElements.define("biometry-
|
|
535
|
+
customElements.define("biometry-enrollment", BiometryEnrollment);
|
|
427
536
|
|
|
428
537
|
function getDefaultExportFromCjs (x) {
|
|
429
538
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -1420,4 +1529,4 @@ class ProcessVideoComponent extends HTMLElement {
|
|
|
1420
1529
|
}
|
|
1421
1530
|
customElements.define('process-video', ProcessVideoComponent);
|
|
1422
1531
|
|
|
1423
|
-
export {
|
|
1532
|
+
export { BiometryEnrollment, BiometrySDK, ProcessVideoComponent };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare class BiometryEnrollment extends HTMLElement {
|
|
2
|
+
private readonly shadow;
|
|
3
|
+
private sdk;
|
|
4
|
+
private videoElement;
|
|
5
|
+
private canvasElement;
|
|
6
|
+
private captureButton;
|
|
7
|
+
private resultCode?;
|
|
8
|
+
private description?;
|
|
9
|
+
constructor();
|
|
10
|
+
static get observedAttributes(): string[];
|
|
11
|
+
get apiKey(): string | null;
|
|
12
|
+
set apiKey(value: string | null);
|
|
13
|
+
get userFullname(): string | null;
|
|
14
|
+
set userFullname(value: string | null);
|
|
15
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
16
|
+
connectedCallback(): void;
|
|
17
|
+
disconnectedCallback(): void;
|
|
18
|
+
validateAttributes(): void;
|
|
19
|
+
init(): void;
|
|
20
|
+
private cleanup;
|
|
21
|
+
private initializeSDK;
|
|
22
|
+
private toggleState;
|
|
23
|
+
private attachSlotListeners;
|
|
24
|
+
private setupCamera;
|
|
25
|
+
private capturePhoto;
|
|
26
|
+
}
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
private readonly shadow;
|
|
3
|
-
private sdk;
|
|
4
|
-
private videoElement;
|
|
5
|
-
private canvasElement;
|
|
6
|
-
private captureButton;
|
|
7
|
-
private resultCode?;
|
|
8
|
-
private description?;
|
|
9
|
-
constructor();
|
|
10
|
-
static get observedAttributes(): string[];
|
|
11
|
-
get apiKey(): string | null;
|
|
12
|
-
set apiKey(value: string | null);
|
|
13
|
-
get userFullname(): string | null;
|
|
14
|
-
set userFullname(value: string | null);
|
|
15
|
-
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
16
|
-
connectedCallback(): void;
|
|
17
|
-
disconnectedCallback(): void;
|
|
18
|
-
validateAttributes(): void;
|
|
19
|
-
init(): void;
|
|
20
|
-
private cleanup;
|
|
21
|
-
private initializeSDK;
|
|
22
|
-
private toggleState;
|
|
23
|
-
private attachSlotListeners;
|
|
24
|
-
private setupCamera;
|
|
25
|
-
private capturePhoto;
|
|
26
|
-
}
|
|
1
|
+
export {};
|