Type Definitions


getTokenCallback() → {Promise.<string>}

Description

This callback is called when the SDK needs a valid token (because of a new request or an expired token).
The token must comes from the client's back-end. To get a token the client's back-end should call Identity API.

Returns
  • A promise that resolves with a valid token.

onCameraAccessGrantedCallback( result ) → {Promise.<void>}

Description

This callback is called after the SDK tried to access to the camera, so the client can handle the camera interaction result and notify the user.

Parameters
Name Type Description
result CameraAccessResult

Indicates whether the camera access was granted or not.

Returns
  • A promise that resolves when the callback is finished.

onErrorCallback( error ) → {Promise.<{shouldRetry: boolean}>}

Description

This callback is called if an error occurs when the SDK calls Identity API to verify the user, so the client can handle the error and decide whether to retry the operation.

Parameters
Name Type Description
error any

The error that occurred.

Returns
  • A boolean indicating whether to retry the operation. Token expiration errors are retried automatically by the SDK.

MainCameraAccessResult

Description

This object describes the main result of the camera access.

Properties
Name Type Description
GRANTED string

value: "granted" - The camera access was granted.

DENIED string

value: "denied" - The camera access was denied.

NO_CAMERA string

value: "no-camera" - The camera access was denied because there is no camera.

CAMERA_ERROR string

value: "camera-error" - The camera access was denied because of an error.


DetailedCameraAccessResult

Description

This object describes the detailed result of the camera access.

Properties
Name Type Description
GRANTED string

value: "granted" - The camera access was granted.

ABORT_ERROR string

value: "abort-error" - The camera access was denied because there some problem occured which prevented the device from being used.

NOT_ALLOWED_ERROR string

value: "not-allowed-error" - The camera access was denied because either the browser context was insecure (the page was loaded using HTTP rather than HTTPS) or the user is not permitted access to the device in the current session or globally.

NOT_FOUND_ERROR string

value: "not-found-error" - The camera access was denied because no media tracks of the type specified were found that satisfy the given constraints (Resolution: min: 320x240; ideal: 640x480).

NOT_READABLE_ERROR string

value: "not-readable-error" - The camera access was denied because a hardware error occured at the operating system/browser/web page which prevented the access to the device (although the user granted the permission).

OVERCONSTRAINED_ERROR string

value: "overconstrained-error" - The camera access was denied because no camera was found with the given constraints (Resolution: min: 320x240; ideal: 640x480).

SECURITY_ERROR string

value: "security-error" - The camera access was denied because user media support was disabled on the web page.

UNKNOWN_ERROR string

value: "unknown-error" - The camera access was denied because of an unknown error.