跳到主要内容

收集 SDK 返回值

.initialize() 方法

.initialize() 方法负责初始化人脸识别和活体检测组件。执行此方法后,相机在组件内初始化以进行照片采集。

拒绝场景:

  • 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.'
}

.open() 方法

此方法负责启动采集,将开始与用户的交互以收集活体证明。此方法返回一个 Promise,在采集完成后以采集照片的密钥(image_key)响应。

Promise resolution:

{ 
status: string //
image_key: string; // Image key that identifies the image on the server to later be used for validation.
}
 {
status: "SUCCESS",
image_key: "d8a3b1c4-9e2f-47a5-8c3d-1b2e5...";
}

Promise rejection:

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

拒绝场景:

  • User Canceled:

    {
    status: "FAILURE",
    reason: "USER_CANCELED",
    description: "User pressed the back button."
    }
  • Invalid Token:(当 client_session_key 无效或过期时发生)

    {
    status: "FAILURE",
    reason: "INVALID_TOKEN",
    description: "Authentication token expired or invalid"
    }