Methods
-
<async> init( region, getToken [, mediaStream ] ) → {Promise.<InitResult>}
-
Description
Initializes the SDK.
Important: This method must be called before callingverifyDuplicate.Parameters
Name Type Attributes Default Description regionstring The region to use. Valid values are "eu" and "us".
getTokengetTokenCallback A callback that returns a valid token from the back-end.
mediaStreamMediaStream <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
Throws
-
<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 collectionNamestring The name of the collection to use. If the collection does not exist, it will be created.
includeDemographicalInfobool Indicates whether to include demographical info in the result.
onCameraAccessGrantedCallbackonCameraAccessGrantedCallback <optional> ()=>Promise.resolve() A callback that is called after the SDK tried to access to the camera.
onErrorCallbackonErrorCallback <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.retryCountInCaseNoFacenumber <optional> 5 The number of times to retry if no face is detected.
Returns
-
<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 collectionNamestring The name of the collection to use. If the collection does not exist, it will be created.
imagestring The string containing the base64 encoded image data to use in the format: "data:image/png;base64, ..."
includeDemographicalInfobool Indicates whether to include demographical info in the result.
onErrorCallbackonErrorCallback <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
-
getCameraManager() → {CameraManager}
-
Description
Returns the internal camera manager, so the client can control the retrieval of the image from the camera.
Returns