biometry-sdk 1.1.1 → 1.2.2

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 (3) hide show
  1. package/README.md +120 -26
  2. package/dist/sdk.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,16 +1,25 @@
1
1
  # biometry-sdk
2
2
 
3
3
  ## Overview
4
- The **Biometry Web SDK** is a software development kit (SDK) designed to facilitate the integration of Biometry's API services.
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, UI components, and utilities enables biometric onboarding (face and voice), liveness checks, and user consent.
5
+
5
6
 
6
7
  ## Features
7
- - **Consent management**: Ask a permission to store their biometric data for authentication using Biometry.
8
- - **Voice onboarding**: Onboard voice for Voice Recognition.
8
+ - **Consent Management**:
9
+ - Ask a permission to store their biometric data for authentication using Biometry.
10
+ - Collect user permission to store their biometric data for authentication using Biometry.
11
+ - Important: You must obtain consent before performing any onboarding or video processing.
12
+ - **Voice onboarding**:
13
+ - Enroll a user’s voice, creating a voice model for future authentication.
9
14
  - **Face onboarding**: Onboard face for face recognition.
10
- - Includes a customizable **Face Onboarding UI Component** for streamlined user interactions.
11
- - **Face match**: Compares extracted image from user’s personal document with the frame from the `/process-video.`
12
- - **Process video**: Process the video through Biometry services to check liveness and authorize user.
13
- - (UI Component for this feature coming soon)
15
+ - Onboard a user’s face for facial recognition.
16
+ - **Face Onboarding UI Component:** A ready-to-use, customizable component for capturing and processing face data.
17
+ - **Face match**:
18
+ - Compares an extracted image from a user’s personal document to an image frame captured during onboarding or `/process-video.`
19
+ - **Process video**:
20
+ - Checks user liveness and authorizes users based on video input.
21
+ - **Process Video UI Component:** A ready-to-use, customizable component for capturing and processing video.
22
+
14
23
 
15
24
  ## Installation
16
25
  ```bash
@@ -33,31 +42,30 @@ console.log(response);
33
42
 
34
43
  ## Example
35
44
 
36
- You can find an example in the example/ directory. The example demonstrates how to integrate the SDK into a React app.
37
-
45
+ You can find an example in the example/ directory. The example demonstrates how you might integrate the BiometrySDK in a React component with the state.
38
46
  ## UI Components
39
- The **Biometry Web SDK** includes reusable and customizable web components for key features. These components make it simple to add biometric functionalities to your application.
47
+ 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.
40
48
 
41
49
  ### Face Onboarding Component
42
- The `Face Onboarding` component provides an intuitive interface for onboarding users with their camera. It integrates with the `BiometrySDK` to handle backend communication and error states.
50
+ This component provides an intuitive interface for onboarding users with their cameras. It integrates directly with the `BiometrySDK backend`, managing camera capture, consent checks, and error handling.
43
51
 
44
52
  ### Integration
45
53
  Here's how to integrate the `Face Onboarding` component into your application:
46
54
 
47
55
  **Option 1: Using npm (Recommended for full SDK usage)**
48
56
  1. Install the SDK package via **npm**:
49
- ```bash
50
- npm install biometry-sdk
51
- ```
57
+ ```bash
58
+ npm install biometry-sdk
59
+ ```
52
60
  2. Import the component in your **index.js** or equivalent JavaScript file:
53
- ```javascript
54
- // index.js
55
- import './node_modules/biometry-sdk/dist/components/biometry-onboarding.js';
56
- ```
61
+ ```javascript
62
+ // index.js
63
+ import './node_modules/biometry-sdk/dist/components/biometry-onboarding.js';
64
+ ```
57
65
  3. Connect the script to your **HTML file** and use the component:
58
- ```html
59
- <script type="module" src="./index.js"></script>
60
- ```
66
+ ```html
67
+ <script type="module" src="./index.js"></script>
68
+ ```
61
69
 
62
70
 
63
71
  **Option 2: Using CDN (Quick Integration)**
@@ -66,9 +74,14 @@ import './node_modules/biometry-sdk/dist/components/biometry-onboarding.js';
66
74
  ```
67
75
 
68
76
  ### Usage
69
- The `api-key` and `user-fullname` attributes are required for the component to function.
77
+ **Required attributes:**
78
+ - `api-key`: Your Biometry API key.
79
+ - `user-fullname`: The user’s full name (used in data storage and consent).
70
80
 
71
- Custom slots allow you to style and customize UI elements, loading, success, and error states.
81
+ **Slots:**
82
+ - `video`: Your custom <video> element.
83
+ - `button`: Custom capture button.
84
+ - `loading`, `success`, `error-no-face`, `error-multiple-faces`, `error-not-centered`, `error-other`: Custom UI messages for different states.
72
85
 
73
86
  **Basic Usage**
74
87
  ```html
@@ -98,12 +111,93 @@ Custom slots allow you to style and customize UI elements, loading, success, and
98
111
  ```
99
112
 
100
113
  ### Process Video Component
101
- Coming soon...
114
+ 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.
115
+
116
+ ### Integration
117
+ **Option 1: Install via npm**
118
+ 1. To include the component in your project, install the biometry-sdk package:
119
+ ```bash
120
+ npm install biometry-sdk
121
+ ```
122
+ 2. After installation, import the component into your project:
123
+ ```javascript
124
+ // index.js
125
+ import './node_modules/biometry-sdk/dist/components/process-video.js'
126
+ ```
127
+ 3. Include the component in your HTML:
128
+ You can skip the npm installation and include the component directly in your HTML:
129
+ ```html
130
+ <script type="module" src="./index.js"></script>
131
+ <process-video ...></process-video>
132
+ ```
133
+ **Option 2: Using CDN (Quick Integration)**
134
+ ```html
135
+ <script type="module" src="https://cdn.jsdelivr.net/npm/biometry-sdk/dist/components/process-video.js"></script>
136
+ <process-video ...></process-video>
137
+ ```
138
+ ### Usage
139
+ **Basic Usage**
140
+ ```html
141
+ <process-video
142
+ api-key="your-api-key"
143
+ user-fullname="Lionel Messi"
144
+ ></process-video>
145
+ ```
102
146
 
147
+ **Advanced Usage**
148
+ ```html
149
+ <process-video
150
+ api-key="eyJhb...apikey"
151
+ user-fullname="John Doe Uulu"
152
+ >
153
+ <!-- Custom video element -->
154
+ <video slot="video" muted playsinline style="border-radius: 1rem;"></video>
155
+
156
+ <!-- Custom buttons -->
157
+ <button slot="record-button">Custom Record</button>
158
+ <button slot="stop-button">Custom Stop</button>
159
+
160
+ <!-- Custom file input -->
161
+ <input slot="file-input" type="file" accept="video/*" />
162
+
163
+ <!-- Custom submit button -->
164
+ <button slot="submit-button">Custom Submit</button>
165
+
166
+ <!-- Custom messages -->
167
+ <div slot="loading">Processing...</div>
168
+ <div slot="error">An error occurred. Please try again.</div>
169
+ <div slot="success">Video submitted successfully!</div>
170
+ </process-video>
171
+ ```
172
+ **Note:**
173
+ - All default elements and messages are functional out-of-the-box.
174
+ - Replace slots if you want to customize the UI or functionality.
175
+ - Call giveConsent() before using any biometric methods to ensure compliance with data processing requirements.
176
+
177
+ ## Best Practices
178
+ 1. **Always Acquire Consent**
179
+ - Before performing Face Onboarding or Process Video, you can call:
180
+ ```javascript
181
+ sdk.giveConsent(true, userFullName);
182
+ ```
183
+ - Or directly send a request to the `/consent` in the [official documentation](https://developer.biometrysolutions.com/overview/).
184
+
185
+ This ensures legal compliance and user awareness when storing and processing biometric data.
186
+ 3. **Handle Errors Gracefully**
187
+ - The SDK methods throw errors if something goes wrong (e.g., network, permission, or detection errors). Use try/catch or .catch() to handle them.
188
+ 4. **Security**
189
+ - Protect your API key. Avoid exposing it in public repositories or client-side code if possible.
190
+
103
191
  ## License
104
192
 
105
193
  This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
106
194
 
107
195
  ## More Information
108
-
109
- For more detailed documentation on the Biometry API, visit the [official documentation](https://developer.biometrysolutions.com/overview/).
196
+ 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.
197
+
198
+ ## Quick Reference
199
+ - Install: `npm install biometry-sdk`
200
+ - Consent: `sdk.giveConsent(true, userFullName)` (Required before onboarding/processing)
201
+ - Voice Onboarding: `sdk.enrollVoice(file, userFullName)`
202
+ - Face Onboarding: `sdk.enrollFace(file, userFullName)`
203
+ - Process Video: `sdk.processVideo(file, phrase, userFullName)`
package/dist/sdk.js CHANGED
@@ -42,7 +42,7 @@ export class BiometrySDK {
42
42
  is_consent_given: isConsentGiven,
43
43
  user_fullname: userFullName,
44
44
  };
45
- const response = await this.request('/consent', 'POST', body);
45
+ const response = await this.request('/api-consent/consent', 'POST', body);
46
46
  return {
47
47
  is_consent_given: response.is_consent_given,
48
48
  user_fullname: response.user_fullname,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biometry-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.2.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [