biometry-sdk 2.1.2 → 2.3.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/README.md +13 -160
- package/dist/index.d.ts +0 -1
- package/package.json +2 -10
- package/dist/react.js +0 -1328
- package/dist/react.js.map +0 -1
- package/dist/ui/biometry-enrollment.d.ts +0 -24
- package/dist/ui/doc-auth.d.ts +0 -23
- package/dist/ui/index.d.ts +0 -3
- package/dist/ui/process-video.d.ts +0 -50
- package/dist/ui/react/BiometryEnrollment.d.ts +0 -16
- package/dist/ui/react/ProcessVideo.d.ts +0 -25
- package/dist/ui/react/index.d.ts +0 -4
- package/dist/ui/types.d.ts +0 -12
- package/dist/ui.js +0 -1480
- package/dist/ui.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# biometry-sdk
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
|
-
The **Biometry Web SDK** is a software development kit designed to simplify the integration of Biometry's API services into your web application. Providing tools
|
|
4
|
+
The **Biometry Web SDK** is a software development kit designed to simplify the integration of Biometry's API services into your web application. Providing tools and utilities enables biometric enrollment (face and voice), liveness checks, and user consent.
|
|
5
5
|
|
|
6
6
|
## Table of Contents:
|
|
7
7
|
- [Installation](#installation)
|
|
@@ -16,9 +16,6 @@ The **Biometry Web SDK** is a software development kit designed to simplify the
|
|
|
16
16
|
- [Typical FaceMatch Flow](#typical-facematch-flow)
|
|
17
17
|
- [Error Handling](#error-handling)
|
|
18
18
|
- [Security And Privacy Considerations](#security-and-privacy-considerations)
|
|
19
|
-
- [UI Components](#ui-components)
|
|
20
|
-
- [Face Enrollment Component](#face-enrollment-component)
|
|
21
|
-
- [Process Video Component](#process-video-component)
|
|
22
19
|
- [License](#license)
|
|
23
20
|
- [More Information](#more-information)
|
|
24
21
|
- [Quick Reference](#quick-reference)
|
|
@@ -69,7 +66,7 @@ You **must** obtain user authorization consent before performing any biometric o
|
|
|
69
66
|
});
|
|
70
67
|
```
|
|
71
68
|
- The first argument (`true`) indicates that the user has granted consent.
|
|
72
|
-
- The second argument is the user
|
|
69
|
+
- The second argument is the user's full name (used for record-keeping within Biometry).
|
|
73
70
|
|
|
74
71
|
#### 2.2 Give Storage Consent
|
|
75
72
|
You **must** obtain user consent before storing biometric data (Face Enrollment, Voice Enrollment):
|
|
@@ -81,10 +78,10 @@ You **must** obtain user consent before storing biometric data (Face Enrollment,
|
|
|
81
78
|
});
|
|
82
79
|
```
|
|
83
80
|
- The first argument (`true`) indicates that the user has granted consent.
|
|
84
|
-
- The second argument is the user
|
|
81
|
+
- The second argument is the user's full name (used for record-keeping within Biometry).
|
|
85
82
|
|
|
86
83
|
### 3. Face Enrollment
|
|
87
|
-
Enroll a user
|
|
84
|
+
Enroll a user's face for future recognition or matching:
|
|
88
85
|
```javascript
|
|
89
86
|
const faceFile = new File([/* face image bytes */], 'face.jpg', { type: 'image/jpeg' });
|
|
90
87
|
|
|
@@ -94,7 +91,7 @@ Enroll a user’s face for future recognition or matching:
|
|
|
94
91
|
```
|
|
95
92
|
|
|
96
93
|
### 4. Voice Enrollment
|
|
97
|
-
Enroll a user
|
|
94
|
+
Enroll a user's voice for future authentication checks:
|
|
98
95
|
```javascript
|
|
99
96
|
const voiceFile = new File([/* voice audio bytes */], 'voice.wav', { type: 'audio/wav' });
|
|
100
97
|
|
|
@@ -103,7 +100,7 @@ Enroll a user’s voice for future authentication checks:
|
|
|
103
100
|
console.log('Voice Enrollment Response:', voiceResponse);
|
|
104
101
|
```
|
|
105
102
|
### 5. Process Video
|
|
106
|
-
Process a user
|
|
103
|
+
Process a user's video for liveness checks and identity authorization:
|
|
107
104
|
```javascript
|
|
108
105
|
const videoFile = new File([/* file parts */], 'video.mp4', { type: 'video/mp4' });
|
|
109
106
|
const phrase = "one two three four five six";
|
|
@@ -171,16 +168,16 @@ DocAuth is a way to authenticate a user's document. It is useful when you want t
|
|
|
171
168
|
## Advanced Usage And Best Practices
|
|
172
169
|
### Typical FaceMatch Flow
|
|
173
170
|
One common advanced scenario involves document authentication in enrollment face and face matching:
|
|
174
|
-
1. Face Enrollment: Capture the user
|
|
175
|
-
2. Process Video: Capture the user
|
|
176
|
-
3. Face Match: Compare the extracted face from the document with the user
|
|
171
|
+
1. Face Enrollment: Capture the user's live face or the user uploads a picture of their identity document (front side with the face)
|
|
172
|
+
2. Process Video: Capture the user's live face
|
|
173
|
+
3. Face Match: Compare the extracted face from the document with the user's live face to verify identity.
|
|
177
174
|
|
|
178
175
|
Below is a possible flow (method names in your SDK may vary slightly depending on your integration setup):
|
|
179
176
|
```javascript
|
|
180
177
|
// 1. Acquire user storage consent
|
|
181
178
|
await sdk.giveStorageConsent(true, userFullName);
|
|
182
179
|
|
|
183
|
-
// 2. Enroll or capture the user
|
|
180
|
+
// 2. Enroll or capture the user's face
|
|
184
181
|
// (Either using enrollFace or processVideo, depending on your user flow)
|
|
185
182
|
const userFaceFile = new File([/* user selfie bytes */], 'image.jpg', { type: 'image/jpeg' });
|
|
186
183
|
const userVideoFile = new File([/* user selfie bytes */], 'video.mp4', { type: 'video/*' });
|
|
@@ -189,7 +186,7 @@ Below is a possible flow (method names in your SDK may vary slightly depending o
|
|
|
189
186
|
// 3. Acquire user authorization consent. It's required to use enrolled face for using biometric data.
|
|
190
187
|
await sdk.giveAuthorizationConsent(true, userFullName);
|
|
191
188
|
|
|
192
|
-
// 4. Face Match (Compare video face with user
|
|
189
|
+
// 4. Face Match (Compare video face with user's enrolled face)
|
|
193
190
|
const faceMatchResponse = await sdk.faceMatch(
|
|
194
191
|
userFaceFile,
|
|
195
192
|
userVideoFile,
|
|
@@ -198,7 +195,7 @@ Below is a possible flow (method names in your SDK may vary slightly depending o
|
|
|
198
195
|
|
|
199
196
|
// 5. Evaluate the faceMatch result
|
|
200
197
|
if (faceMatchResponse.matchResult === 'match') {
|
|
201
|
-
console.log('User video face matches user
|
|
198
|
+
console.log('User video face matches user's live face. Identity verified!');
|
|
202
199
|
} else {
|
|
203
200
|
console.log('User video face does NOT match. Additional verification needed.');
|
|
204
201
|
}
|
|
@@ -229,153 +226,9 @@ Always wrap calls in try/catch and provide user-friendly messages or fallback lo
|
|
|
229
226
|
3. **Data Minimization:** Only store data that is required for your use case.
|
|
230
227
|
4. **Regulatory Compliance:** Check local regulations (GDPR, CCPA, etc.) for storing and processing biometric data.
|
|
231
228
|
|
|
232
|
-
## UI Components
|
|
233
|
-
In addition to direct SDK methods, the Biometry Web SDK offers reusable Web Components that handle user interactions (camera, video recording, error states) automatically.
|
|
234
|
-
The Biometry Web SDK includes reusable, customizable web components for crucial features. These components are easy to embed into your application and handle the most common biometric operations with minimal setup.
|
|
235
|
-
|
|
236
|
-
### Integration
|
|
237
|
-
**Option 1: Using npm (Recommended for full SDK usage)**
|
|
238
|
-
1. Install the SDK package via **npm**:
|
|
239
|
-
```bash
|
|
240
|
-
npm install biometry-sdk
|
|
241
|
-
```
|
|
242
|
-
2. Import the component in your **index.js** or equivalent JavaScript file:
|
|
243
|
-
```javascript
|
|
244
|
-
// index.js
|
|
245
|
-
import './node_modules/biometry-sdk/dist/biometry-sdk.esm.js';
|
|
246
|
-
```
|
|
247
|
-
**Option 2: Using CDN (Quick Integration)**
|
|
248
|
-
```html
|
|
249
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/biometry-sdk/dist/biometry-sdk.esm.js"></script>
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### Face Enrollment Component
|
|
253
|
-
This component provides an intuitive interface for enrollment users with their cameras. It integrates directly with the `BiometrySDK backend`, managing camera capture, consent checks, and error handling.
|
|
254
|
-
|
|
255
|
-
### Usage
|
|
256
|
-
**Required attributes:**
|
|
257
|
-
- `endpoint`: The URL of your endpoint that will process the [face enrollment](https://developer.biometrysolutions.com/api/face-enrollment/). All captured data will be sent to the endpoint.
|
|
258
|
-
- `user-fullname`: The user’s full name (used in data storage and consent).
|
|
259
|
-
|
|
260
|
-
**Slots:**
|
|
261
|
-
- `video`: Your custom `<video>` element.
|
|
262
|
-
- `button`: Custom capture button.
|
|
263
|
-
- `loading`, `success`, `error-no-face`, `error-multiple-faces`, `error-not-centered`, `error-other`: Custom UI messages for different states.
|
|
264
|
-
|
|
265
|
-
**Basic Usage**
|
|
266
|
-
```html
|
|
267
|
-
<biometry-enrollment
|
|
268
|
-
endpoint="your-endpoint-link"
|
|
269
|
-
user-fullname="John Doe">
|
|
270
|
-
</biometry-enrollment>
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
**Advanced Usage**
|
|
274
|
-
```html
|
|
275
|
-
<biometry-enrollment
|
|
276
|
-
endpoint="your-endpoint-link"
|
|
277
|
-
user-fullname="John Doe">
|
|
278
|
-
|
|
279
|
-
<video slot="video" autoplay playsinline style="width: 100%; border-radius: 10px;"></video>
|
|
280
|
-
<button slot="button" style="padding: 10px 20px; font-size: 16px;">Capture</button>
|
|
281
|
-
|
|
282
|
-
<!-- Custom Status Messages -->
|
|
283
|
-
<div slot="loading">Please wait while we process your photo...</div>
|
|
284
|
-
<div slot="success">Congratulations! You have been enrolled.</div>
|
|
285
|
-
<div slot="error-no-face">No face detected. Make sure your face is visible.</div>
|
|
286
|
-
<div slot="error-multiple-faces">Multiple faces detected. Please try again alone.</div>
|
|
287
|
-
<div slot="error-not-centered">Align your face with the center of the screen.</div>
|
|
288
|
-
<div slot="error-other">Oops! Something went wrong. Please try again.</div>
|
|
289
|
-
</biometry-enrollment>
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Process Video Component
|
|
293
|
-
The **Process Video** component enables you to record, upload, and process a video within your application. It integrates with Biometry's services to check liveness and authorize the user.
|
|
294
|
-
|
|
295
|
-
### Usage
|
|
296
|
-
**Basic Usage**
|
|
297
|
-
```html
|
|
298
|
-
<process-video
|
|
299
|
-
endpoint="your-endpoint-link"
|
|
300
|
-
user-fullname="John Doe"
|
|
301
|
-
></process-video>
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
**Advanced Usage**
|
|
305
|
-
```html
|
|
306
|
-
<process-video
|
|
307
|
-
endpoint="your-endpoint-link"
|
|
308
|
-
user-fullname="John Doe"
|
|
309
|
-
>
|
|
310
|
-
<!-- Custom video element -->
|
|
311
|
-
<video slot="video" muted playsinline style="border-radius: 1rem;"></video>
|
|
312
|
-
|
|
313
|
-
<!-- Custom buttons -->
|
|
314
|
-
<button slot="record-button">Custom Record</button>
|
|
315
|
-
<button slot="stop-button">Custom Stop</button>
|
|
316
|
-
|
|
317
|
-
<!-- Custom file input -->
|
|
318
|
-
<input slot="file-input" type="file" accept="video/*" />
|
|
319
|
-
|
|
320
|
-
<!-- Custom submit button -->
|
|
321
|
-
<button slot="submit-button">Custom Submit</button>
|
|
322
|
-
|
|
323
|
-
<!-- Custom messages -->
|
|
324
|
-
<div slot="loading">Processing...</div>
|
|
325
|
-
<div slot="error">An error occurred. Please try again.</div>
|
|
326
|
-
<div slot="success">Video submitted successfully!</div>
|
|
327
|
-
</process-video>
|
|
328
|
-
```
|
|
329
|
-
**Note:**
|
|
330
|
-
- All default elements and messages are functional out-of-the-box.
|
|
331
|
-
- Replace slots if you want to customize the UI or functionality.
|
|
332
|
-
- Call giveConsent() before using any biometric methods to ensure compliance with data processing requirements.
|
|
333
|
-
|
|
334
|
-
### Doc Auth Component
|
|
335
|
-
The **Doc Auth** component allows users to scan and upload an ID document using their camera. It is designed to be simple, secure, and easy to integrate into your application.
|
|
336
|
-
|
|
337
|
-
#### Description
|
|
338
|
-
This component provides a rectangular scanning area using the user's camera, a button to capture the document, and uploads a high-quality JPEG image to your backend endpoint. The backend should process the image using the Biometry SDK and your API key (never expose your API key to the client).
|
|
339
|
-
|
|
340
|
-
#### Required attributes:
|
|
341
|
-
- `endpoint`: The URL of your endpoint that will process the [document authentication](https://developer.biometrysolutions.com/api/doc-auth/). All captured data will be sent to this endpoint for secure processing.
|
|
342
|
-
- `user-fullname`: The user’s full name (used in data storage and consent).
|
|
343
|
-
|
|
344
|
-
#### Slots:
|
|
345
|
-
- (No custom slots are required, but you can style the component using CSS variables.)
|
|
346
|
-
|
|
347
|
-
#### Basic Usage
|
|
348
|
-
```html
|
|
349
|
-
<id-document-scan
|
|
350
|
-
endpoint="your-endpoint-link"
|
|
351
|
-
user-fullname="John Doe"
|
|
352
|
-
></id-document-scan>
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
#### Customization
|
|
356
|
-
You can override the default styles using CSS custom properties. For example:
|
|
357
|
-
```css
|
|
358
|
-
id-document-scan {
|
|
359
|
-
--primary-color: #4caf50;
|
|
360
|
-
--scan-area-border: 2px solid #4caf50;
|
|
361
|
-
}
|
|
362
|
-
```
|
|
363
|
-
Here is the list of available CSS variables:
|
|
364
|
-
```css
|
|
365
|
-
--primary-color: #007bff;
|
|
366
|
-
--button-bg: var(--primary-color);
|
|
367
|
-
--button-text-color: #fff;
|
|
368
|
-
--border-radius: 8px;
|
|
369
|
-
--scan-area-border: 2px dashed var(--primary-color);
|
|
370
|
-
--scan-area-bg: rgba(0, 123, 255, 0.05);
|
|
371
|
-
--button-padding: 10px 24px;
|
|
372
|
-
--button-radius: 6px;
|
|
373
|
-
--button-hover-bg: #0056b3;
|
|
374
|
-
```
|
|
375
|
-
|
|
376
229
|
## License
|
|
377
230
|
|
|
378
231
|
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
|
|
379
232
|
|
|
380
233
|
## More Information
|
|
381
|
-
For more detailed information on Biometry
|
|
234
|
+
For more detailed information on Biometry's API endpoints, parameters, and responses, visit the official [Biometry API Documentation](https://developer.biometrysolutions.com/overview/). If you have questions or need help, please reach out to our support team or create a GitHub issue.
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "biometry-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/sdk.js",
|
|
6
6
|
"module": "dist/sdk.js",
|
|
@@ -13,14 +13,6 @@
|
|
|
13
13
|
"./sdk": {
|
|
14
14
|
"import": "./dist/sdk.js",
|
|
15
15
|
"types": "./dist/sdk/index.d.ts"
|
|
16
|
-
},
|
|
17
|
-
"./ui": {
|
|
18
|
-
"import": "./dist/ui.js",
|
|
19
|
-
"types": "./dist/ui/index.d.ts"
|
|
20
|
-
},
|
|
21
|
-
"./react": {
|
|
22
|
-
"import": "./dist/react.js",
|
|
23
|
-
"types": "./dist/ui/react/index.d.ts"
|
|
24
16
|
}
|
|
25
17
|
},
|
|
26
18
|
"files": [
|
|
@@ -56,4 +48,4 @@
|
|
|
56
48
|
"dependencies": {
|
|
57
49
|
"fix-webm-duration": "^1.0.6"
|
|
58
50
|
}
|
|
59
|
-
}
|
|
51
|
+
}
|