biometry-sdk 1.0.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 +30 -0
- package/dist/index.d.ts +2 -0
- package/dist/sdk.d.ts +63 -0
- package/dist/types.d.ts +82 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# biometry-web-sdk
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
The `biometry-web-sdk` is a software development kit (SDK) designed to facilitate the integration of Biometry's API services.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
- Consent management (For storing facial and audio biometric data)
|
|
8
|
+
- Voice onboarding
|
|
9
|
+
- Face onboarding
|
|
10
|
+
- Face match
|
|
11
|
+
- Process video
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
```bash
|
|
15
|
+
npm install biometry-sdk
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
```typescript
|
|
20
|
+
import { BiometrySDK } from 'biometry-sdk';
|
|
21
|
+
|
|
22
|
+
const sdk = new BiometrySDK('put your API key here');
|
|
23
|
+
|
|
24
|
+
const videoFile = new File([/* file parts */], "video.mp4", {type: "video/mp4"});
|
|
25
|
+
const phrase = "one two three four five six";
|
|
26
|
+
const userFullName = "John Doe";
|
|
27
|
+
|
|
28
|
+
const response = await sdk.processVideo(videoFile, phrase, userFullName);
|
|
29
|
+
console.log(response);
|
|
30
|
+
```
|
package/dist/index.d.ts
ADDED
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ConsentResponse, FaceMatchResponse, FaceOnboardingResponse, VoiceOnboardingResponse } from "./types";
|
|
2
|
+
export declare class BiometrySDK {
|
|
3
|
+
private apiKey;
|
|
4
|
+
private static readonly BASE_URL;
|
|
5
|
+
constructor(apiKey: string);
|
|
6
|
+
private request;
|
|
7
|
+
/**
|
|
8
|
+
* Submits consent for a user.
|
|
9
|
+
*
|
|
10
|
+
* @param {boolean} isConsentGiven - Indicates whether the user has given consent.
|
|
11
|
+
* @param {string} userFullName - The full name of the user giving consent.
|
|
12
|
+
* @returns {Promise<ConsentResponse>} A promise resolving to the consent response.
|
|
13
|
+
* @throws {Error} - If the user's full name is not provided or if the request fails.
|
|
14
|
+
*/
|
|
15
|
+
giveConsent(isConsentGiven: boolean, userFullName: string): Promise<ConsentResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Onboards a user's voice for biometric authentication.
|
|
18
|
+
*
|
|
19
|
+
* @param {File} audio - The audio file containing the user's voice.
|
|
20
|
+
* @param {string} userFullName - The full name of the user being onboarded.
|
|
21
|
+
* @param {string} uniqueId - A unique identifier for the onboarding process.
|
|
22
|
+
* @param {string} phrase - The phrase spoken in the audio file.
|
|
23
|
+
* @param {string} [requestUserProvidedId] - An optional user-provided ID to link transactions within a unified group.
|
|
24
|
+
* @returns {Promise<VoiceOnboardingResponse>} - A promise resolving to the voice onboarding response.
|
|
25
|
+
* @throws {Error} - If required parameters are missing or the request fails.
|
|
26
|
+
*/
|
|
27
|
+
onboardVoice(audio: File, userFullName: string, uniqueId: string, phrase: string, requestUserProvidedId?: string): Promise<VoiceOnboardingResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Onboards a user's face for biometric authentication.
|
|
30
|
+
*
|
|
31
|
+
* @param {File} face - Image file that contains user's face.
|
|
32
|
+
* @param {string} userFullName - The full name of the user being onboarded.
|
|
33
|
+
* @param {string} isDocument - Indicates whether the image is a document.
|
|
34
|
+
* @param {string} [requestUserProvidedId] - An optional user-provided ID to link transactions within a unified group.
|
|
35
|
+
* @returns {Promise<FaceOnboardingResponse>} - A promise resolving to the voice onboarding response.
|
|
36
|
+
* @throws {Error} - If required parameters are missing or the request fails.
|
|
37
|
+
*/
|
|
38
|
+
onboardFace(face: File, userFullName: string, isDocument?: boolean, requestUserProvidedId?: string): Promise<FaceOnboardingResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Matches a user's face from video against a reference image.
|
|
41
|
+
*
|
|
42
|
+
* @param {File} image - Reference image file that contains user's face.
|
|
43
|
+
* @param {string} video - Video file that contains user's face.
|
|
44
|
+
* @param {string} userFullName - Pass the full name of end-user to process Voice and Face recognition services.
|
|
45
|
+
* @param {string} processVideoRequestId - ID from the response header of /process-video endpoint.
|
|
46
|
+
* @param {boolean} usePrefilledVideo - Pass true to use the video from the process-video endpoint.
|
|
47
|
+
* @param {string} [requestUserProvidedId] - An optional user-provided ID to link transactions within a unified group.
|
|
48
|
+
* @returns {Promise<FaceMatchResponse>} - A promise resolving to the voice onboarding response.
|
|
49
|
+
* @throws {Error} - If required parameters are missing or the request fails.
|
|
50
|
+
*/
|
|
51
|
+
matchFaces(image: File, video?: File, userFullName?: string, processVideoRequestId?: string, usePrefilledVideo?: boolean, requestUserProvidedId?: string): Promise<FaceMatchResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Process the video through Biometry services to check liveness and authorize user
|
|
54
|
+
*
|
|
55
|
+
* @param {File} video - Video file that you want to process.
|
|
56
|
+
* @param {string} phrase - Set of numbers that user needs to say out loud in the video.
|
|
57
|
+
* @param {string} userFullName - Pass the full name of end-user to process Voice and Face recognition services.
|
|
58
|
+
* @param {string} requestUserProvidedId - An optional user-provided ID to link transactions within a unified group.
|
|
59
|
+
* @param {object} deviceInfo - Pass the device information in JSON format to include in transaction.
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
processVideo(video: File, phrase: string, userFullName?: string, requestUserProvidedId?: string, deviceInfo?: object): Promise<any>;
|
|
63
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export interface ConsentResponse {
|
|
2
|
+
is_consent_given: boolean;
|
|
3
|
+
user_fullname: string;
|
|
4
|
+
}
|
|
5
|
+
export interface VoiceOnboardingResponse {
|
|
6
|
+
status: "good" | "qafailed" | "enrolled";
|
|
7
|
+
}
|
|
8
|
+
export interface FaceOnboardingResponse {
|
|
9
|
+
onboard_result: {
|
|
10
|
+
code: number;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
document_auth: {
|
|
14
|
+
document_type: string;
|
|
15
|
+
country_code: string;
|
|
16
|
+
nationality_code: string;
|
|
17
|
+
nationality_name: string;
|
|
18
|
+
sex: string;
|
|
19
|
+
first_name: string;
|
|
20
|
+
father_name: string;
|
|
21
|
+
last_name: string;
|
|
22
|
+
expiry_date: string;
|
|
23
|
+
document_number: string;
|
|
24
|
+
birth_date: string;
|
|
25
|
+
portrait_photo: string;
|
|
26
|
+
signature: string;
|
|
27
|
+
document_category: string;
|
|
28
|
+
issuing_state: string;
|
|
29
|
+
front_document_type_id: string;
|
|
30
|
+
contains_rfid: boolean;
|
|
31
|
+
};
|
|
32
|
+
message: string;
|
|
33
|
+
}
|
|
34
|
+
export interface FaceMatchResponse {
|
|
35
|
+
code: number;
|
|
36
|
+
result: number;
|
|
37
|
+
description: string;
|
|
38
|
+
anchor: {
|
|
39
|
+
code: number;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
target: {
|
|
43
|
+
code: number;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface ProcessVideoResponse {
|
|
48
|
+
data: {
|
|
49
|
+
"Active Speaker Detection": {
|
|
50
|
+
code: number;
|
|
51
|
+
description: string;
|
|
52
|
+
result: number;
|
|
53
|
+
};
|
|
54
|
+
"Face Liveness Detection": {
|
|
55
|
+
code: number;
|
|
56
|
+
description: string;
|
|
57
|
+
result: boolean;
|
|
58
|
+
};
|
|
59
|
+
"Face Recognition": {
|
|
60
|
+
code: number;
|
|
61
|
+
description: string;
|
|
62
|
+
};
|
|
63
|
+
"Visual Speech Recognition": {
|
|
64
|
+
code: number;
|
|
65
|
+
description: string;
|
|
66
|
+
result: string;
|
|
67
|
+
};
|
|
68
|
+
"Voice Recognition": {
|
|
69
|
+
status: string;
|
|
70
|
+
id: string;
|
|
71
|
+
score: number;
|
|
72
|
+
imposter_prob: number;
|
|
73
|
+
log_odds: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
result_conditions: {
|
|
77
|
+
failed_conditions: any[];
|
|
78
|
+
failed_refer_conditions: any[];
|
|
79
|
+
status: string;
|
|
80
|
+
};
|
|
81
|
+
message: string;
|
|
82
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "biometry-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsc",
|
|
7
|
+
"test": "jest"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"description": "",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/jest": "^29.5.14",
|
|
15
|
+
"jest": "^29.7.0",
|
|
16
|
+
"ts-jest": "^29.2.5",
|
|
17
|
+
"typescript": "^5.7.2"
|
|
18
|
+
},
|
|
19
|
+
"compilerOptions": {
|
|
20
|
+
"target": "ES2017",
|
|
21
|
+
"module": "CommonJS",
|
|
22
|
+
"outDir": "./dist",
|
|
23
|
+
"strict": true,
|
|
24
|
+
"declaration": true
|
|
25
|
+
},
|
|
26
|
+
"include": [
|
|
27
|
+
"src/**/*"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"require": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"README.md"
|
|
38
|
+
]
|
|
39
|
+
}
|