biometry-sdk 2.3.0 → 2.3.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 (2) hide show
  1. package/README.md +25 -15
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -3,15 +3,20 @@
3
3
  ## Overview
4
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
+ We also have UI component library for [React](https://www.npmjs.com/package/biometry-react-components). You can you this SDK in combination with it.
7
+
6
8
  ## Table of Contents:
7
9
  - [Installation](#installation)
8
10
  - [Basic Usage (Direct SDK Methods)](#basic-usage-direct-sdk-methods)
9
- - [Consents](#1-consents)
10
- - [1.1 Give Authorization Consent](#11-give-authorization-consent)
11
- - [1.2 Give Storage Consent](#12-give-storage-consent)
12
- - [Face Enrollment](#2-face-enrollment)
13
- - [Voice Enrollment](#3-voice-enrollment)
14
- - [Process Video](#4-process-video)
11
+ - [Sessions](#1-sessions)
12
+ - [Consents](#2-consents)
13
+ - [1.1 Give Authorization Consent](#21-give-authorization-consent)
14
+ - [1.2 Give Storage Consent](#22-give-storage-consent)
15
+ - [Face Enrollment](#3-face-enrollment)
16
+ - [Voice Enrollment](#4-voice-enrollment)
17
+ - [Process Video](#5-process-video)
18
+ - [Face Match](#6-face-match)
19
+ - [DocAuth](#7-docauth)
15
20
  - [Advanced Usage And Best Practices](#advanced-usage-and-best-practices)
16
21
  - [Typical FaceMatch Flow](#typical-facematch-flow)
17
22
  - [Error Handling](#error-handling)
@@ -38,16 +43,20 @@ const sdk = new BiometrySDK('YOUR_API_KEY');
38
43
  ### Example
39
44
  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.
40
45
 
41
- ### 1. Sessions
46
+ ## 1. Sessions
42
47
  Session is a way to group transactions together. It is useful when you want to group transactions that are related to each other. For example, you can start a session and then use the session ID to link transactions within a unified group.
48
+
49
+ Note: Use sessions generated by Biometry for API calls. Biometry sessions always have `sess_` prefix. Do not use own uuids or any other values.
50
+
51
+ Example:
43
52
  ```javascript
44
- const response = await sdk.startSession();
53
+ const response = await sdk.startSession(); // returns uuid with `sess_` prefix
45
54
  const sessionId = response.data;
46
55
 
47
56
  const voiceFile = new File([/* voice audio bytes */], 'voice.wav', { type: 'audio/wav' });
48
57
  const faceFile = new File([/* face image bytes */], 'face.jpg', { type: 'image/jpeg' });
49
58
 
50
- // Use the session ID to link transactions within a unified group
59
+ // Use the session ID in X-Session-Id header to link transactions within a unified group
51
60
  await sdk.giveStorageConsent(true, 'John Doe', { sessionId });
52
61
  await sdk.enrollFace(faceFile, 'John Doe', { sessionId });
53
62
  await sdk.enrollVoice(voiceFile, 'John Doe', { sessionId });
@@ -55,8 +64,8 @@ Session is a way to group transactions together. It is useful when you want to g
55
64
  // Go to the Results page in your dashboard and see the transactions grouped by the session ID
56
65
  ```
57
66
 
58
- ### 2. Consents
59
- #### 2.1 Give Authorization Consent
67
+ ## 2. Consents
68
+ ### 2.1 Give Authorization Consent
60
69
  You **must** obtain user authorization consent before performing any biometric operations (Face Recognition, Voice Recognition, etc.):
61
70
  ```javascript
62
71
  await sdk.giveAuthorizationConsent(true, 'John Doe');
@@ -68,7 +77,7 @@ You **must** obtain user authorization consent before performing any biometric o
68
77
  - The first argument (`true`) indicates that the user has granted consent.
69
78
  - The second argument is the user's full name (used for record-keeping within Biometry).
70
79
 
71
- #### 2.2 Give Storage Consent
80
+ ### 2.2 Give Storage Consent
72
81
  You **must** obtain user consent before storing biometric data (Face Enrollment, Voice Enrollment):
73
82
  ```javascript
74
83
  await sdk.giveStorageConsent(true, 'John Doe');
@@ -80,7 +89,7 @@ You **must** obtain user consent before storing biometric data (Face Enrollment,
80
89
  - The first argument (`true`) indicates that the user has granted consent.
81
90
  - The second argument is the user's full name (used for record-keeping within Biometry).
82
91
 
83
- ### 3. Face Enrollment
92
+ ## 3. Face Enrollment
84
93
  Enroll a user's face for future recognition or matching:
85
94
  ```javascript
86
95
  const faceFile = new File([/* face image bytes */], 'face.jpg', { type: 'image/jpeg' });
@@ -90,7 +99,7 @@ Enroll a user's face for future recognition or matching:
90
99
  console.log('Face Enrollment Response:', faceResponse);
91
100
  ```
92
101
 
93
- ### 4. Voice Enrollment
102
+ ## 4. Voice Enrollment
94
103
  Enroll a user's voice for future authentication checks:
95
104
  ```javascript
96
105
  const voiceFile = new File([/* voice audio bytes */], 'voice.wav', { type: 'audio/wav' });
@@ -99,7 +108,7 @@ Enroll a user's voice for future authentication checks:
99
108
  const voiceResponse = await sdk.enrollVoice(voiceFile, 'John Doe');
100
109
  console.log('Voice Enrollment Response:', voiceResponse);
101
110
  ```
102
- ### 5. Process Video
111
+ ## 5. Process Video
103
112
  Process a user's video for liveness checks and identity authorization:
104
113
  ```javascript
105
114
  const videoFile = new File([/* file parts */], 'video.mp4', { type: 'video/mp4' });
@@ -220,6 +229,7 @@ Always wrap calls in try/catch and provide user-friendly messages or fallback lo
220
229
  console.error('Face match error:', error);
221
230
  }
222
231
  ```
232
+
223
233
  ### Security And Privacy Considerations
224
234
  1. **Protect Your API Key:** Avoid storing your API key in client-side code if possible. Use environment variables or server-side proxies.
225
235
  2. **Obtain Explicit Consent:** Ensure you have a transparent process for obtaining and storing user consent.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biometry-sdk",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "type": "module",
5
5
  "main": "dist/sdk.js",
6
6
  "module": "dist/sdk.js",