Skip to main content

Collecting SDK Returns

The .initialize() method

The .initialize() method is responsible for initializing the facial recognition and liveness proof component. Upon execution, the SDK loads the face detection model and validates device/browser conditions.

Promise resolution:

{
status: "SUCCESS",
data: null
}

Rejection Scenarios:

  • Unsupported Browser:
{
status: "FAILURE",
reason: "UNSUPPORTED_BROWSER",
description: "User browser is not supported."
}
  • Not Mobile Device:
{
status: "FAILURE",
reason: "NOT_MOBILE_DEVICE",
description: "User device is not mobile."
}
  • Initialization Error:
{
status: "FAILURE",
reason: "INITIALIZATION_ERROR",
description: "..."
}

The .open() method

This method receives the clientSessionKey (obtained via server-to-server call) and starts the interaction with the user to collect the liveness proof. It returns a Promise resolved with the captured image key once the flow is complete.

Promise resolution:

{
status: "SUCCESS",
data: string // image_key that identifies the image on the server
}

Example:

{
status: "SUCCESS",
data: "d8a3b1c4-9e2f-47a5-8c3d-1b2e5..."
}

Promise rejection:

{
status: string;
reason: string;
description: string;
}

Rejection Scenarios:

  • User Canceled:
{
status: "FAILURE",
reason: "USER_CANCELED",
description: "User pressed the back button."
}
  • Invalid Token: (occurs when the clientSessionKey is invalid or expired)
{
status: "FAILURE",
reason: "INVALID_TOKEN",
description: "Authentication token expired or invalid"
}
  • Session Superseded: (occurs when .open() is called again on an already open instance)
{
status: "FAILURE",
reason: "SESSION_SUPERSEDED",
description: "A new session has been started before the previous one was completed."
}