### Get Capabilities Response Example
Source: https://developer.idemia.com/capturesdks/web/39
Example of a successful response from the getCapabilities request, detailing server versions and enabled algorithms.
```json
{
"version": "3.25.0",
"bioserver-core": {
"version": "3.25.0",
"currentMode": [
"F6_2_VID65"
]
}
}
```
--------------------------------
### Install Dependencies
Source: https://developer.idemia.com/capturesdks/web/39
Install the required project dependencies.
```Shell
npm install --verbose
```
--------------------------------
### Start Sample Application
Source: https://developer.idemia.com/capturesdks/web/39
Launch the sample application server.
```Shell
npm run start
```
--------------------------------
### VideoStorage Object Example
Source: https://developer.idemia.com/capturesdks/web/39
Example JSON object for VideoStorage, detailing where and how a video is stored.
```json
{
"region": "eu-central-1",
"bucketName": "wbs-video-storage",
"key": "doc-dev/11b57ca2-7798-4c9d-8ab9-3099506d221e/0dec15a2-0ea1-49b2-baf0-812048f9e6da.webm",
"hash": "d32c4ff2770a4f9d4d10d048492dbb456fb153153db5ae5f1454d1442d488093",
"hashAlgorithm": "SHA_256",
"contentType": "video/webm"
}
```
--------------------------------
### Install npm Dependencies
Source: https://developer.idemia.com/capturesdks/web/39
Command to install all necessary npm packages for the project. This should be run once after downloading the source code.
```shell
npm i --verbose
```
--------------------------------
### Run the Demo Server
Source: https://developer.idemia.com/capturesdks/web/39
Command to start the demo server. This should be executed each time you want to run the demo application.
```shell
npm run start
```
--------------------------------
### Get Liveness Challenge Result Request Example
Source: https://developer.idemia.com/capturesdks/web/39
Example cURL command to request the liveness detection result. Ensure to replace placeholders with actual values.
```shell
curl -X GET \
https://[URL_MAIN_PART]/bioserver-app/v2/bio-sessions/{bioSessionId}/liveness-challenge-result \
-H 'apikey: [APIKEY_VALUE]'
```
--------------------------------
### GET /video-server/init-liveness-session/{sessionId}
Source: https://developer.idemia.com/capturesdks/web/39
Retrieves the details of a previously created liveness session.
```APIDOC
## GET /video-server/init-liveness-session/{sessionId}
### Description
Retrieves the status and details of a specific liveness session using its unique session ID.
### Method
GET
### Endpoint
/video-server/init-liveness-session/{sessionId}
### Parameters
#### Path Parameters
- **sessionId** (String) - Required - The unique identifier of the session.
### Request Headers
- **apikey** (String) - Required - API key for authentication.
```
--------------------------------
### Check Environment Versions
Source: https://developer.idemia.com/capturesdks/web/39
Verify the installed versions of Node.js and npm.
```Shell
node -v
npm -v
```
--------------------------------
### Start Live Capture Session
Source: https://developer.idemia.com/capturesdks/web/39
Initiates a synchronous live capture video session to obtain a portrait for biometric comparison.
```Shell
curl -X POST \
https://[URL_MAIN_PART]/gips/v1/identities/[IDENTITY_ID]/attributes/portrait/live-capture-video-session \
-H 'Content-Type: multipart/form-data' \
-H 'apikey: [APIKEY_VALUE]'
```
--------------------------------
### Liveness Session Response Example
Source: https://developer.idemia.com/capturesdks/web/39
Example of a successful HTTP 200 response for a liveness session request.
```HTTP
HTTP/1.1 200
{
"id": "6217fd4f-9710-49f4-88fd-188cd082927d",
"correlationId": "postman-video-correlationId",
"evidenceId": "postman-video-evidenceId",
"callbackURL": "https://localhost/demo-server/liveness-result-callback",
"ttlSeconds": 1800,
"imageStorageEnabled": true,
"livenessMode": "LIVENESS_PASSIVE",
"numberOfChallenge": 2,
"securityLevel": "HIGH",
"created": "2025-06-20T06:32:21.326Z",
"expires": "2025-06-20T07:02:21.326Z"
}
```
--------------------------------
### Initialize Face Capture Client
Source: https://developer.idemia.com/capturesdks/web/39
Example integration of the face capture functionality, including error handling for the 429 status code.
```JavaScript
const faceCaptureOptions = {
wspath: wspath,
bioserverVideoUrl: bioserverVideoUrl,
showChallengeInstruction: (challengeInstruction) => {
// custom code
},
onClientInitEnd: () => {
// custom code
},
showChallengeResult: async () => {
// custom code
},
trackingFn: () => {
// custom code
},
errorFn: (error) => {
if (error.code && error.code === 429) { // user is blocked
// we reset the session when we finished the liveness check real session
resetLivenessDesign();
document.querySelectorAll('.step').forEach((step) => step.classList.add('d-none'));
// the lock counter is displayed to the user
userBlockInterval(new Date(error.unlockDateTime));
document.querySelector('#step-liveness-fp-block').classList.remove('d-none');
}
// custom code
}
}
client = await BioserverVideo.initFaceCaptureClient(faceCaptureOptions);
client.startCapture({stream: videoStream});
// both of previous call can raise the 429 error message
```
--------------------------------
### Network Connectivity Usage Example
Source: https://developer.idemia.com/capturesdks/web/39
Demonstrates how to implement the onNetworkCheckUpdate callback to handle connectivity results and threshold errors.
```JavaScript
// call it once document loaded
window.onload = () => {
function onNetworkCheckUpdate(networkCheckResults) {
console.log({networkCheckResults});
if (!networkCheckResults.goodConnectivity) {
console.log('BAD user connectivity');
if (networkCheckResults.upload) {
console.log('Upload requirements not reached');
console.log('Upload speed threshold is ' + BioserverNetworkCheck.UPLOAD_SPEED_THRESHOLD);
} else if (networkCheckResults.latencyMs) {
console.log('Latency requirements not reached');
console.log('Latency speed threshold is ' + BioserverNetworkCheck.LATENCY_SPEED_THRESHOLD);
} else {
console.log('Failed to check user connectivity requirements');
}
// STOP user process and display error message
}
}
const urlBasePath = '/demo-server';
BioserverNetworkCheck.connectivityMeasure({
uploadURL: urlBasePath + '/network-speed',
latencyURL: urlBasePath + '/network-latency',
onNetworkCheckUpdate: onNetworkCheckUpdate,
errorFn: (e) => {
console.error('An error occurred while calling connectivityMeasure: ', e);
}
});
}
```
--------------------------------
### HTML Structure for Simple Client
Source: https://developer.idemia.com/capturesdks/web/39
Basic HTML setup for the face capture client, including video element and buttons. Ensure the video element has an ID that matches the one used in the JavaScript.
```html
Simple Client
```
--------------------------------
### Landmarks Object Example
Source: https://developer.idemia.com/capturesdks/web/39
Example JSON object for Landmarks, including eye and box detection information.
```json
{
"eyes": {
"x1": 581.0,
"y1": 270.0,
"x2": 695.0,
"y2": 266.0
},
"box": {
"x": 465,
"y": 149,
"width": 348,
"height": 441
}
}
```
--------------------------------
### Face Capture Client Initialization
Source: https://developer.idemia.com/capturesdks/web/39
This snippet demonstrates how to initialize the Face Capture Client with various options and start the face capture process.
```APIDOC
## POST /api/facecapture/init
### Description
Initializes the Face Capture Client and prepares it for capturing facial data for liveness detection.
### Method
POST
### Endpoint
/api/facecapture/init
### Parameters
#### Request Body
- **bioserverVideoUrl** (String) - Optional - The Base URL of the video-server used to construct the websocket URL. Defaults to the browser's current URL if not provided.
- **wspath** (String) - Optional - The webSocket path for server communication. Defaults to "/video-server/engine.io".
- **bioSessionId** (String) - Required - The unique ID for the bio-session where user images will be stored.
- **onClientInitEnd** (Function) - Required - Callback function invoked when client initialization is complete, signaling readiness to display the video stream.
- **trackingFn** (Function) - Required - Callback function that receives face tracking information for each video frame.
- **showChallengeInstruction** (Function) - Required - Callback function to handle liveness challenge instructions, including displaying loaders and managing user interaction during challenges.
- **showChallengeResult** (Function) - Required - Callback function fired after a challenge is completed. Results need to be fetched by the Service Provider.
- **errorFn** (Function) - Required - Callback function to handle errors that occur during the video capture process.
### Request Example
```json
{
"bioserverVideoUrl": "https://$myserver:443",
"wspath": "video-server/engine.io",
"bioSessionId": "your_session_id",
"onClientInitEnd": "() => { console.log('Init ended.') }",
"trackingFn": "(trackingInfo) => { console.log('onTracking', trackingInfo) }",
"showChallengeInstruction": "(challengeInstruction) => { console.log('challenge instructions', challengeInstruction) }",
"showChallengeResult": "() => { console.log('call back the backend to retrieve liveness result'); }",
"errorFn": "(error) => { console.log('face capture error', error) }"
}
```
### Response
#### Success Response (200)
- **clientInstance** (Object) - An instance of the initialized Face Capture Client.
#### Response Example
```json
{
"clientInstance": "[FaceCaptureClient Object]"
}
```
```
--------------------------------
### GET /getCapabilities
Source: https://developer.idemia.com/capturesdks/web/39
Retrieves the version and core configuration details of the bioserver.
```APIDOC
## GET /getCapabilities
### Description
Retrieves the version of the bioserver-video and details regarding the bioserver-core, including enabled matching algorithms.
### Method
GET
### Response
#### Success Response (200)
- **version** (String) - The version of the bioserver-video
- **bioserver-core** (Object) - Details of the bioserver-core
- **bioserver-core.version** (String) - The version of the bioserver-core
- **bioserver-core.currentMode** (Array) - The list of matching algorithms enabled
#### Response Example
{
"version": "3.25.0",
"bioserver-core": {
"version": "3.25.0",
"currentMode": [
"F6_2_VID65"
]
}
}
```
--------------------------------
### Start Face Capture
Source: https://developer.idemia.com/capturesdks/web/39
Initiate face capture by calling this JavaScript function. It establishes a peer-to-peer connection. Wait for 'onClientInitEnd' before displaying the video stream.
```javascript
startCapture(videoStream);
```
--------------------------------
### ImageStorage Object Example
Source: https://developer.idemia.com/capturesdks/web/39
Example JSON object for ImageStorage, specifying storage details for a document image.
```json
{
"region": "eu-central-1",
"bucketName": "wbs-video-storage",
"key": "doc-dev/11b57ca2-7798-4c9d-8ab9-3099506d221e/0dec15a2-0ea1-49b2-baf0-812048f9e6da.png",
"hash": "ff2c4ff2770a4f004dffd048492dbb_ç6fb153153db5ae5f1454d1442d4880(è",
"hashAlgorithm": "SHA_256",
"contentType": "image/png"
}
```
--------------------------------
### Get Portrait Status Response
Source: https://developer.idemia.com/capturesdks/web/39
Example JSON response indicating the status and type of the portrait evidence.
```JSON
{
"status": "INVALID",
"type": "PORTRAIT",
"id": "97d8354e-7297-4eba-be39-1569d4c6342b"
}
```
--------------------------------
### Get Matches API Response Example
Source: https://developer.idemia.com/capturesdks/web/39
This JSON object represents a successful response from the getMatches API, detailing a reference face and a candidate face, along with their matching score and other metadata.
```json
[
{
"reference": {
"id": "aa0bd6ca-1206-415b-af94-8d2c18aa9c70",
"friendlyName": "Portrait of Jane Doe",
"digest": "39bd0d9606a772b1e7076401f32f14bdde403b9608e789e0771b90fb79b664a4",
"mode": "F6_4_VID60X",
"imageType": "SELFIE",
"quality": 295,
"landmarks": {
"eyes": {
"x1": 1191.4584,
"y1": 582.79565,
"x2": 1477.8955,
"y2": 580.3324
},
"box": {
"x": 961,
"y": 388,
"width": 506,
"height": 674
}
}
},
"candidate": {
"id": "6e1741f1-3715-416a-bfc6-4fc381d228a3",
"friendlyName": "Portrait of Jane Doe",
"digest": "94d1b6ff2acf368c3e0ccaebe1d8e447ed1ccd7b596dc5cac3c13a4822b256c6",
"mode": "F6_4_VID60X",
"imageType": "ID_DOCUMENT",
"quality": 186,
"landmarks": {
"eyes": {
"x1": 141.83296,
"y1": 217.47075,
"x2": 241.09653,
"y2": 216.0568
},
"box": {
"x": 61,
"y": 153,
"width": 253,
"height": 370
}
}
},
"score": 7771.43408203125,
"falseAcceptanceRate": 0.000000000028650475616752694,
"correlationId": "891a6728-1ac4-11e7-93ae-92361f002671",
"created": "2017-05-18T12:41:09.58Z",
"expires": "2017-05-18T12:42:00.844Z",
"signature": "eyJhbGciOiJSUzI1NiJ9.ew0KICAicm…0NCiAgICB9DQHSQfU7Q"
}
]
```
--------------------------------
### LandmarksEyes Object Example
Source: https://developer.idemia.com/capturesdks/web/39
Example JSON object for LandmarksEyes, detailing eye detection coordinates.
```json
{
"x1": 581.0,
"y1": 270.0,
"x2": 695.0,
"y2": 266.0
}
```
--------------------------------
### LandmarksBox Object Example
Source: https://developer.idemia.com/capturesdks/web/39
Example JSON object for LandmarksBox, specifying face position within a bounding box.
```json
{
"x": 465,
"y": 149,
"width": 348,
"height": 441
}
```
--------------------------------
### DeviceInfo JSON Structure
Source: https://developer.idemia.com/capturesdks/web/39
Example of the JSON object used for device information.
```JSON
{
"deviceModel" : "SM-G935F",
"osType" : "Android",
"osVersion": "7.0",
"browserName": "Chrome",
"browserVersion": "18.0.2"
}
```
--------------------------------
### GET /video-server/v2/capabilities
Source: https://developer.idemia.com/capturesdks/web/39
Retrieves server capabilities, version number, and supported algorithms. Acts as a health check.
```APIDOC
## GET /video-server/v2/capabilities
### Description
Get capabilities of the server, along with the version number and the supported algorithms. It acts also as a health check.
### Method
GET
### Endpoint
https://[URL_MAIN_PART]/video-server/v2/capabilities
### Parameters
#### Header Fields
- **apikey** (String) - Required - The APIKEY value provided to the service provider
### Request Example
curl -X GET \
https://[URL_MAIN_PART]/video-server/v2/capabilities \
-H 'apikey: [APIKEY_VALUE]'
```
--------------------------------
### AgeEstimated Object Example
Source: https://developer.idemia.com/capturesdks/web/39
Example JSON object for AgeEstimated, showing age estimation results and threshold.
```json
{
"aboveThreshold": true,
"ageEstimated": 29.1,
"threshold": 18
}
```
--------------------------------
### Start Face Capture
Source: https://developer.idemia.com/capturesdks/web/39
Initiates face capture without liveness verification. The media stream should only be displayed after the onClientInitEnd callback is received to prevent visual glitches.
```JavaScript
1const faceCaptureClient = await BioserverVideo.initFaceCaptureClient(faceCaptureOptions);
2
3// getMediaStream call to retrieve stream from SDK
4// start face capture (ex: when user click on capture button)
5faceCaptureClient.startCapture({stream: videoStream});
6// wait the callback from onClientInitEnd before displaying the stream to enduser
7
8// stop face capture (ex: when user click on stop capture button)
9faceCaptureClient.cancel();
```
--------------------------------
### Usage Example for connectivityMeasure
Source: https://developer.idemia.com/capturesdks/web/39
Demonstrates how to implement the onNetworkCheckUpdate callback to handle network check results and display appropriate messages to the user.
```APIDOC
## JavaScript Usage Example
### Description
This example shows how to call the `connectivityMeasure` function and handle its results using the `onNetworkCheckUpdate` callback.
### Code
```javascript
window.onload = () => {
function onNetworkCheckUpdate(networkCheckResults) {
console.log({networkCheckResults});
if (!networkCheckResults.goodConnectivity) {
console.log('BAD user connectivity');
if (networkCheckResults.upload) {
console.log('Upload requirements not reached');
console.log('Upload speed threshold is ' + BioserverNetworkCheck.UPLOAD_SPEED_THRESHOLD);
} else if (networkCheckResults.latencyMs) {
console.log('Latency requirements not reached');
console.log('Latency speed threshold is ' + BioserverNetworkCheck.LATENCY_SPEED_THRESHOLD);
} else {
console.log('Failed to check user connectivity requirements');
}
// STOP user process and display error message
}
}
const urlBasePath = '/demo-server';
BioserverNetworkCheck.connectivityMeasure({
uploadURL: urlBasePath + '/network-speed',
latencyURL: urlBasePath + '/network-latency',
onNetworkCheckUpdate: onNetworkCheckUpdate,
errorFn: (e) => {
console.error('An error occurred while calling connectivityMeasure: ', e);
}
});
}
```
```
--------------------------------
### Start and Stop Face Capture
Source: https://developer.idemia.com/capturesdks/web/39
Event listeners for capture and stop buttons. The start capture function requires the video stream, and the stop function calls the client's cancel method.
```javascript
document.querySelector('#capture').addEventListener('click', async () => {
if (client) client.startCapture({stream: videoStream});
});
document.querySelector('#stop').addEventListener('click', async () => {
if (client) client.cancel();
});
```
--------------------------------
### POST /gips/v1/identities/{IDENTITY_ID}/attributes/portrait/live-capture-video-session
Source: https://developer.idemia.com/capturesdks/web/39
Starts a live capture video session to capture a portrait for biometric comparison.
```APIDOC
## POST /gips/v1/identities/{IDENTITY_ID}/attributes/portrait/live-capture-video-session
### Description
Starts a live capture video session of the person in order to capture the best quality image that will be compared with a portrait extracted from an evidence reference.
### Method
POST
### Endpoint
https://[URL_MAIN_PART]/gips/v1/identities/[IDENTITY_ID]/attributes/portrait/live-capture-video-session
### Parameters
#### Path Parameters
- **IDENTITY_ID** (string) - Required - The identity ID.
### Response
#### Success Response (200)
- **status** (string) - Status of the portrait.
- **type** (string) - Type of capture.
- **id** (string) - The user portrait identifier.
- **sessionId** (string) - The Biometric Service session identifier.
#### Response Example
{
"status": "PROCESSING",
"type": "PORTRAIT",
"id": "2d5e81c6-a600-47ed-aa22-2101b940fed6",
"sessionId": "891a6728-1ac4-11e7-93ae-92361f002671"
}
```
--------------------------------
### Challenge Instruction Constants
Source: https://developer.idemia.com/capturesdks/web/39
Possible values for the showChallengeInstruction parameter to guide the end user.
```JavaScript
// if LIVENESS_ACTIVE mode is requested:
"FACEFLOW_CHALLENGE_2D" // End user shall move its face following the pattern
// if LIVENESS_PASSIVE or LIVENESS_PASSIVE_VIDEO mode is requested:
"TRACKER_CHALLENGE_DONT_MOVE" // End user shall not move its face
// if challenge is finished on every liveness:
"TRACKER_CHALLENGE_PENDING" // UX should be hidden with a loader until reception of 'showChallengeResult' callback. Video channel must not be closed during the final image computation.
```
--------------------------------
### List Attached Devices with ADB
Source: https://developer.idemia.com/capturesdks/web/39
Run this command in the terminal to start the ADB daemon and display the status of connected devices. Ensure your phone is connected via USB with file sharing enabled and USB debugging activated.
```Shell
adb devices
```
```Shell
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
XXXX128PX device
```
--------------------------------
### Example Error Response for BioserverEnvironment.detection
Source: https://developer.idemia.com/capturesdks/web/39
Represents a JSON response indicating an unsupported browser environment.
```JSON
{
"envDetected": {
"os": {
"isSupported": true,
"supportedList": []
},
"browser": {
"isSupported": false,
"supportedList": [
{
"name": "Chrome",
"minimumVersion": "56"
},
{
"name": "Firefox",
"minimumVersion": "50"
},
{
"name": "Opera",
"minimumVersion": "47"
},
{
"name": "Edge",
"minimumVersion": "17"
},
{
"name": "HuaweiBrowser",
"minimumVersion": "12"
}
]
}
},
"message": "You seem to be using an unsupported browser."
}
```
--------------------------------
### Initiate Liveness Session
Source: https://developer.idemia.com/capturesdks/web/39
Asynchronously initiates a liveness session by making a GET request to a backend endpoint. It returns a Promise that resolves with the session data or rejects on error.
```javascript
async function initLivenessSession () {
console.log('init liveness session');
return new Promise((resolve, reject) => {
const xhttp = new window.XMLHttpRequest();
let path = '$URL-INTEGRATOR-BACK-END/video-server/init-liveness-session/'; // please fill with your backend endpoint
xhttp.open('GET', path, true);
xhttp.responseType = 'json';
xhttp.onload = function () {
if (this.status >= 200 && this.status < 300) {
resolve(xhttp.response);
} else {
console.error('initLivenessSession failed');
reject();
}
};
xhttp.onerror = function () {
reject();
};
xhttp.send();
});
}
```
--------------------------------
### Face Object Example
Source: https://developer.idemia.com/capturesdks/web/39
This JSON object demonstrates the structure of a 'Face' object, including its unique identifier, friendly name, image details, quality score, and detected landmarks.
```json
{
"id": "6e1741f1-3715-416a-bfc6-4fc381d228a3",
"friendlyName": "Portrait of Jane Doe",
"digest": "94d1b6ff2acf368c3e0ccaebe1d8e447ed1ccd7b596dc5cac3c13a4822b256c6",
"mode": "F6_4_VID60X",
"imageType": "ID_DOCUMENT",
"quality": 186,
"landmarks": {
"eyes": {
"x1": 141.83296,
"y1": 217.47075,
"x2": 241.09653,
"y2": 216.0568
},
"box": {
"x": 61,
"y": 153,
"width": 253,
"height": 370
}
}
}
```
--------------------------------
### Generate Self-Signed Certificate with OpenSSL
Source: https://developer.idemia.com/capturesdks/web/39
Use this command to generate a self-signed certificate for development purposes. Ensure OpenSSL is installed.
```bash
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -subj '/CN=demo-server' -config openssl.cnf -extensions v3_req -nodes
```
--------------------------------
### Retrieve Session Location Header
Source: https://developer.idemia.com/capturesdks/web/39
Example of the HTTP 201 response header containing the URI for the created bio-session.
```HTTP
1HTTP/1.1 201 Created
2Location: /v2/bio-sessions/0991cedc-9111-4b9d-9e4e-8d6eb4db488f
```
--------------------------------
### Get Capabilities Health Check
Source: https://developer.idemia.com/capturesdks/web/39
Retrieves server capabilities, version, and supported algorithms using an API key for authentication.
```Shell
curl -X GET \
https://[URL_MAIN_PART]/video-server/v2/capabilities \
-H 'apikey: [APIKEY_VALUE]'
```
--------------------------------
### Callback Request Body Example
Source: https://developer.idemia.com/capturesdks/web/39
JSON payload sent to the service provider's callback URL containing the session identifier.
```JSON
{
"sessionId": "7b4e38f6-de53-4dd5-a8b8-985833f771d2"
}
```
--------------------------------
### Get Media Stream for Face Capture
Source: https://developer.idemia.com/capturesdks/web/39
Requests access to camera devices and returns a MediaStream. Prompts the user for permission. Note that front-camera streams are often flipped and may require CSS transform:scale(-1,1) for a mirror effect. Handles errors like camera access denial.
```javascript
1BioserverVideo.getMediaStream(mediaObjectInput)
```
```javascript
// Requests video stream from the default camera device
// HTML Code:
const videoStream = await BioserverVideo.getMediaStream({videoId: 'user-video'});
// Assign stream to srcObject (mandatory)
videoElement.srcObject = videoStream;
```
--------------------------------
### Initialize Face Capture Client
Source: https://developer.idemia.com/capturesdks/web/39
Demonstrates how to obtain a session ID and initialize the BioserverVideo client with required callbacks and configuration options.
```JavaScript
// get liveness session id from Location header provided by backend API call
const sessionId = await initLivenessSession();
// init a face capture client
const faceCaptureOptions = {
wspath: 'video-server/engine.io',
bioserverVideoUrl: '$URL-WBS',
bioSessionId: sessionId,
onClientInitEnd: () => { console.log("Init ended. Remove loading for video") },
trackingFn: (trackingInfo) => { console.log("onTracking", trackingInfo) },
errorFn: (error) => { console.log("face capture error", error) },
showChallengeInstruction: (challengeInstruction) => { console.log("challenge instructions", challengeInstruction) },
showChallengeResult: () => { console.log("call back the backend to retrieve liveness result"); }
};
// Show loader on GUI
const faceCaptureClient = await BioserverVideo.initFaceCaptureClient(faceCaptureOptions);
```
--------------------------------
### Get Portrait Status Request
Source: https://developer.idemia.com/capturesdks/web/39
Retrieves the status of a portrait capture using a GET request.
```Shell
curl -X GET \
https://[URL_MAIN_PART]/gips/v1/identities/[IDENTITY_ID]/status/[PORTRAIT_ID] \
-H 'apikey: [APIKEY_VALUE]'
```
--------------------------------
### Call Initialization Function
Source: https://developer.idemia.com/capturesdks/web/39
Calls the main initialization function to set up the client and video stream when the script loads.
```javascript
init();
```
--------------------------------
### FaceCapture: initFaceCaptureClient
Source: https://developer.idemia.com/capturesdks/web/39
Initializes a face capture client with the provided configuration.
```APIDOC
## initFaceCaptureClient
### Description
This function initializes a face capture client with the given configuration. The returned client allows starting/stopping face capture, capturing tracking info, managing challenges, and handling errors.
### Parameters
#### Request Body
- **options** (Object) - Configuration options for the face capture client
```
--------------------------------
### Initialize Face Capture Client
Source: https://developer.idemia.com/capturesdks/web/39
Initializes a face capture client with provided configuration options. The client manages face capture, tracking, challenges, and errors. It's recommended to avoid optional parameters for optimal settings.
```javascript
1BioserverVideo.initFaceCaptureClient(options)
```
--------------------------------
### Initialize Face Capture Client and Video Stream
Source: https://developer.idemia.com/capturesdks/web/39
Initializes the face capture client with specified options and retrieves the user's camera video stream. The client requires a session ID obtained from the backend.
```javascript
let client, videoStream;
async function init() {
// get liveness session id from backend
const sessionId = await initLivenessSession();
// initialize the face capture client with callbacks
const faceCaptureOptions = {
wspath: 'video-server/engine.io',
bioserverVideoUrl: '$URL-WBS',
bioSessionId: sessionId,
onClientInitEnd: () => { console.log("Init ended. Remove loading for video") },
trackingFn: (trackingInfo) => { console.log("tracking", trackingInfo) },
errorFn: (error) => { console.log("got error", face) },
showChallengeInstruction: (challengeInstruction) => { console.log("got challenge instruction", challengeInstruction) },
showChallengeResult: () => { console.log("got challenge result -> callBackend to fetch result") }
};
client = await BioserverVideo.initFaceCaptureClient(faceCaptureOptions);
// get user camera video
// HTML Code:
videoStream = await BioserverVideo.getMediaStream({videoId: 'user-video'});
// display the video stream
document.querySelector('#user-video').srcObject = videoStream;
}
```
--------------------------------
### BioserverEnvironment Success Response
Source: https://developer.idemia.com/capturesdks/web/39
Example of a successful response object from the detection API.
```JSON
{
"envDetected": {
"os": {
"isSupported": true,
"supportedList": [],
"isMobile": false
},
"browser": {
"isSupported": true,
"supportedList": []
}
},
"message": ""
}
```
--------------------------------
### Initialize Face Capture Client
Source: https://developer.idemia.com/capturesdks/web/39
Use this JavaScript function to initialize a face capture client. Configuration options determine behavior for tracking, challenges, and error events.
```javascript
initFaceCaptureClient(configuration);
```
--------------------------------
### POST /initLivenessSession
Source: https://developer.idemia.com/capturesdks/web/39
Initializes a new liveness session for biometric verification.
```APIDOC
## POST /initLivenessSession
### Description
Creates a new liveness session to perform biometric verification. The response provides a Location header containing the session URI.
### Method
POST
### Request Body
- **livenessMode** (String) - Required - The type of liveness (LIVENESS_ACTIVES, LIVENESS_PASSIVE, LIVENESS_PASSIVE_VIDEO).
- **securityLevel** (String) - Optional - Fraud detection strictness (LOW, MEDIUM, HIGH). Default is HIGH.
- **correlationId** (String) - Optional - Custom identifier for the transaction.
- **evidenceId** (String) - Optional - Custom identifier for ID&V.
- **ageThreshold** (Integer) - Optional - Threshold for age estimation.
- **callbackURL** (URL) - Optional - URL to notify when results are available.
### Response
#### Success Response (201)
- **Location** (String) - Header containing the URI of the created bio-session.
#### Error Response
- **400** - Invalid request format.
- **401** - Authentication required.
- **403** - Missing permissions.
- **429** - Server busy.
- **500** - Internal error.
```
--------------------------------
### GET getMatches
Source: https://developer.idemia.com/capturesdks/web/39
Retrieves the matching results for a specific bio-session and reference face.
```APIDOC
## GET getMatches
### Description
Retrieves the matching results for a specific bio-session and reference face.
### Method
GET
### Parameters
#### Query Parameters
- **bioSessionId** (String) - Required - The identifier of the bio-session containing the faces.
- **referenceFaceId** (String) - Required - The identifier of the reference face.
### Response
#### Success Response (200)
- **reference** (Face) - The reference face.
- **candidate** (Face) - A candidate face.
- **score** (Number) - The matching score.
- **falseAcceptanceRate** (Number) - The false acceptance rate (FAR).
- **correlationId** (String) - Optional - A custom identifier from the caller.
- **evidenceId** (String) - Optional - A custom identifier from the caller (ID&V).
- **created** (Datetime) - The date on which the match has been created.
- **expires** (Datetime) - The date after which the match will expire.
- **signature** (String) - Optional - A digital signature (JWS) of the response.
#### Response Example
[
{
"reference": {
"id": "aa0bd6ca-1206-415b-af94-8d2c18aa9c70",
"friendlyName": "Portrait of Jane Doe",
"digest": "39bd0d9606a772b1e7076401f32f14bdde403b9608e789e0771b90fb79b664a4",
"mode": "F6_4_VID60X",
"imageType": "SELFIE",
"quality": 295
},
"candidate": {
"id": "6e1741f1-3715-416a-bfc6-4fc381d228a3",
"friendlyName": "Portrait of Jane Doe",
"digest": "94d1b6ff2acf368c3e0ccaebe1d8e447ed1ccd7b596dc5cac3c13a4822b256c6",
"mode": "F6_4_VID60X",
"imageType": "ID_DOCUMENT",
"quality": 186
},
"score": 7771.43408203125,
"falseAcceptanceRate": 0.000000000028650475616752694,
"correlationId": "891a6728-1ac4-11e7-93ae-92361f002671",
"created": "2017-05-18T12:41:09.58Z",
"expires": "2017-05-18T12:42:00.844Z",
"signature": "eyJhbGciOiJSUzI1NiJ9.ew0KICAicm…0NCiAgICB9DQHSQfU7Q"
}
]
```
--------------------------------
### Export Certificate and Key to PKCS#12
Source: https://developer.idemia.com/capturesdks/web/39
After generating the key and certificate, export them into a PKCS#12 keystore file. This is necessary for importing into applications.
```bash
openssl pkcs12 -export -out demo-server.p12 -inkey key.pem -in cert.pem -keypbe AES-256-CBC -certpbe AES-256-CBC
```
--------------------------------
### Include UI Extension Script
Source: https://developer.idemia.com/capturesdks/web/39
Include the UI extension library to customize capture and challenge instruction elements.
```HTML
```
--------------------------------
### General Error Response
Source: https://developer.idemia.com/capturesdks/web/39
Example of a standard error response handled by errorFn or thrown as an exception.
```JSON
{
"code": "1031",
"error": "Video Capture TimeOut: No face detected!"
}
```
--------------------------------
### ID&V Demo Integration Configuration
Source: https://developer.idemia.com/capturesdks/web/39
Configuration options for enabling and setting up the ID&V Demo integration. Set the 'IDPROOFING' flag to true to enable this feature.
```javascript
// ID&V Demo integration
GIPS_URL: '/gips',
GIPS_RS_API_Key: '',
IDPROOFING: false, // Enable ID&V Demo integration : true or false
```
--------------------------------
### GET /bioserver-app/v2/bio-sessions/{bioSessionId}/liveness-challenge-result
Source: https://developer.idemia.com/capturesdks/web/39
Retrieves the face and liveness detection results for a specific biometric session.
```APIDOC
## GET /bioserver-app/v2/bio-sessions/{bioSessionId}/liveness-challenge-result
### Description
Retrieves the face and liveness detection result for a given bio-session identifier.
### Method
GET
### Endpoint
/bioserver-app/v2/bio-sessions/{bioSessionId}/liveness-challenge-result
### Parameters
#### Path Parameters
- **bioSessionId** (String) - Required - The identifier of the bio-session that contains livenessParameter.
#### Header Parameters
- **apikey** (String) - Required - The client application API key.
### Response
#### Success Response (200)
- **livenessStatus** (String) - Status of liveness challenge result (SUCCESS, FAILED, SPOOF, ERROR, TIMEOUT)
- **diagnostic** (String) - Optional - Diagnostic in case of liveness failure
- **bestImageId** (String) - The ID of the stored best-image in the session
- **livenessMode** (String) - The liveness mode used (LIVENESS_PASSIVE, LIVENESS_PASSIVE_VIDEO, LIVENESS_ACTIVE)
- **securityLevel** (String) - The security level applied (LOW, MEDIUM, HIGH)
- **numberOfChallenge** (Integer) - Optional - Number of challenges for active liveness
- **deviceInfo** (DeviceInfo) - Optional - Mobile information from nativeSDK
- **imageStorage** (ImageStorage) - Optional - Storage information regarding the best image
- **videoStorage** (VideoStorage) - Optional - Storage information regarding the video generated
- **age** (AgeEstimated) - Optional - Age estimation information
- **signature** (String) - Optional - A digital signature (JWS) of the response
```
--------------------------------
### Initialize Liveness Session Request
Source: https://developer.idemia.com/capturesdks/web/39
Creates a new liveness session with specified parameters.
```Shell
curl -X POST \
https://[URL_MAIN_PART]/video-server/init-liveness-session \
-H 'Content-Type: application/json' \
-H 'apikey: [APIKEY_VALUE]' \
-d '{
"livenessMode": "LIVENESS_PASSIVE_VIDEO",
"callbackURL" : "https://service-provider-site.com/transactions/891a6728-1ac4-11e7-93ae-92361f002671/liveness-result"
}'
```
--------------------------------
### Configure TLS Keystore
Source: https://developer.idemia.com/capturesdks/web/39
Specify the path and password for the TLS keystore file.
```JavaScript
1TLS_KEYSTORE_PATH: path.join(__dirname, 'certs/demo-server.p12'),
2TLS_KEYSTORE_PASSWORD: loadSecretFromFile(path.join(__dirname, 'secrets/tls_keystore_password.txt'))
```
--------------------------------
### Get Portrait Capture
Source: https://developer.idemia.com/capturesdks/web/39
Retrieves the portrait image capture for a given identity. The response is in multi-part data format.
```APIDOC
## POST /gips/v1/identities/attributes/portrait/capture
### Description
Retrieves the portrait image capture associated with an identity. The response is returned as multi-part data containing the binary image content.
### Method
POST
### Endpoint
https://[URL_MAIN_PART]/gips/v1/identities/attributes/portrait/capture
### Parameters
#### Header Parameters
- **apikey** (string) - Required - Client application API key.
- **Content-Type** (string) - Required - Set to 'application'.
### Request Example
```shell
curl -X POST https://[URL_MAIN_PART]/gips/v1/identities/attributes/portrait/capture \
-H 'Content-Type: application' \
-H 'apikey: [APIKEY_VALUE]'
```
### Response
#### Success Response (200)
The response is multi-part data. The binary content of the portrait image is included.
#### Response Example (Multi-part Data Structure)
```
--1b817195-cbe4-485f-90fd-4ed6f27f54a8--
Content-Disposition: form-data; name="Portrait"
Content-Type: application/octet-stream
...
...
--1b817195-cbe4-485f-90fd-4ed6f27f54a8--
```
**Note:** To display the image, remove the multipart headers and footer and use an HTML image element.
```
--------------------------------
### Include Environment Detection Script
Source: https://developer.idemia.com/capturesdks/web/39
Include the environment detection library to verify OS and browser compatibility.
```HTML
```
--------------------------------
### Liveness Graphic Configuration
Source: https://developer.idemia.com/capturesdks/web/39
Configuration options for tooltips, controlled points, challenge points, and challenge lines.
```APIDOC
## Liveness Graphic Configuration
### Parameters
#### Request Body
- **tooltip** (Object) - Optional - Graphic options for tooltips.
- **tooltip.enabled** (Boolean) - Optional - Enables showing tooltips; Default: false.
- **tooltip.backgroundColor** (String) - Optional - Tooltip background color; Default: #ff6700.
- **tooltip.width** (String) - Optional - Tooltip width; Default: 200px.
- **tooltip.fontSize** (String) - Optional - Tooltip font size; Default: 0.8em.
- **tooltip.fontColor** (String) - Optional - Tooltip text color; Default: white.
- **tooltip.duration** (String) - Optional - Tooltip toggle duration in seconds; Default: 4.
- **tooltip.text** (String) - Optional - Tooltip text instructions.
- **controlledPoint** (Object) - Optional - Graphic options for the starting point.
- **controlledPoint.radius** (String) - Optional - Radius of starting point; Default: 40.
- **controlledPoint.color** (String) - Optional - Background color; Default: black.
- **controlledPoint.borderSize** (String) - Optional - Border size; Default: 3.
- **controlledPoint.borderColor** (String) - Optional - Border color; Default: white.
- **challengePoint** (Object) - Optional - Challenge points graphic options.
- **challengePoint.done** (Object) - Optional - Graphics of done challenge points.
- **challengePoint.target** (Object) - Optional - Graphics of targeted challenge points.
- **challengeLines** (Object) - Optional - Challenge lines graphic options.
```
--------------------------------
### Enable ID&V Workflow
Source: https://developer.idemia.com/capturesdks/web/39
Configure the ID&V workflow by enabling IDPROOFING and providing the required GIPS credentials.
```JavaScript
IDPROOFING: true,
GIPS_URL: '/gips',
GIPS_RS_API_Key: ''
```
--------------------------------
### Retrieve Liveness Session via cURL
Source: https://developer.idemia.com/capturesdks/web/39
Endpoint call to retrieve an existing liveness session using a GET request.
```Shell
1curl -X GET \
2 https://[URL_MAIN_PART]/video-server/init-liveness-session/{sessionId} \
3 -H 'apikey: [APIKEY_VALUE]'
```
--------------------------------
### Load WebCapture JavaScript SDK
Source: https://developer.idemia.com/capturesdks/web/39
Include the necessary JavaScript libraries in your HTML to interact with the web capture server.
```HTML
```
--------------------------------
### Launch Screen Mirroring with scrcpy
Source: https://developer.idemia.com/capturesdks/web/39
Execute this command in your terminal to display your phone's screen on your local machine. This is useful for observing the capture process and interacting with the device.
```Shell
scrcpy
```