new IdentitySDK()

Description

Creates an instance of ExperienceSDK - IdentitySDK.

Methods


<async> init( region, getToken [, mediaStream ] ) → {Promise.<InitResult>}

Description

Initializes the SDK.
Important: This method must be called before calling verifyDuplicate.

Parameters
Name Type Attributes Default Description
region string

The region to use. Valid values are "eu" and "us".

getToken getTokenCallback

A callback that returns a valid token from the back-end.

mediaStream MediaStream <optional>

An external media stream to use. If not provided, the SDK will try to access the camera itself. The minimum required resolution is 320x240 and the ideal resolution is 640x480.

Returns
  • A promise that resolves with the init result. *
Throws
  • Will throw an error if the region is invalid.

<async> verifyDuplicate( collectionName, includeDemographicalInfo [, onCameraAccessGrantedCallback [, onErrorCallback [, retryCountInCaseNoFace ] ] ] ) → {Promise.<VerificationResult>}

Description

Verifies if the user is already in the specified collection.

Parameters
Name Type Attributes Default Description
collectionName string

The name of the collection to use. If the collection does not exist, it will be created.

includeDemographicalInfo bool

Indicates whether to include demographical info in the result.

onCameraAccessGrantedCallback onCameraAccessGrantedCallback <optional>
()=>Promise.resolve()

A callback that is called after the SDK tried to access to the camera.

onErrorCallback onErrorCallback <optional>
()=>Promise.resolve({ shouldRetry: true })

A callback that is called when an error occurs when the SDK calls Identity API to verify the user. In a case of an token expiration the SDK will try to get a new token and retry the operation.
In a case of any other error, the client can decide whether to retry the operation. The maximum number of retries is 5.

retryCountInCaseNoFace number <optional>
5

The number of times to retry if no face is detected.

Returns
  • A promise that resolves with the verification result.

<async> verifyDuplicateFromImage( collectionName, image, includeDemographicalInfo [, onErrorCallback ] ) → {Promise.<VerificationResult>}

Description

Verifies if the user is already in the specified collection. Using a base64 encoded image data. This method does not use the camera.

Parameters
Name Type Attributes Default Description
collectionName string

The name of the collection to use. If the collection does not exist, it will be created.

image string

The string containing the base64 encoded image data to use in the format: "data:image/png;base64, ..."

includeDemographicalInfo bool

Indicates whether to include demographical info in the result.

onErrorCallback onErrorCallback <optional>
()=>Promise.resolve({ shouldRetry: true })

A callback that is called when an error occurs when the SDK calls Identity API to verify the user. In a case of an token expiration the SDK will try to get a new token and retry the operation.
In a case of any other error, the client can decide whether to retry the operation. The maximum number of retries is 5.

Returns
  • A promise that resolves with the verification result.

getCameraManager() → {CameraManager}

Description

Returns the internal camera manager, so the client can control the retrieval of the image from the camera.

Returns
  • The camera manager.