export interface Uni { /** * 开始 SOTER 生物认证 * * 文档: [http://uniapp.dcloud.io/api/system/authentication?id=startsoterauthentication](http://uniapp.dcloud.io/api/system/authentication?id=startsoterauthentication) */ startSoterAuthentication: StartSoterAuthentication; /** * 获取本机支持的 SOTER 生物认证方式 * * 文档: [http://uniapp.dcloud.io/api/system/authentication?id=checkissupportsoterauthentication](http://uniapp.dcloud.io/api/system/authentication?id=checkissupportsoterauthentication) */ checkIsSupportSoterAuthentication: CheckIsSupportSoterAuthentication; /** * 获取设备内是否录入如指纹等生物信息 * * 文档: [http://uniapp.dcloud.io/api/system/authentication?id=checkissoterenrolledindevice](http://uniapp.dcloud.io/api/system/authentication?id=checkissoterenrolledindevice) */ checkIsSoterEnrolledInDevice: CheckIsSoterEnrolledInDevice; } export type StartSoterAuthentication = (options: StartSoterAuthenticationOptions) => void; /** * 生物认证方式 */ export type SoterAuthMode = /** * 指纹识别 */ 'fingerPrint' | /** * 人脸识别(暂未支持) */ 'facial' | /** * 声纹识别(暂未支持) */ 'speech'; export type StartSoterAuthenticationSuccess = { /** * 错误码 */ errCode: number, /** * 生物认证方式 * - fingerPrint: 指纹识别 * - facial: 人脸识别(暂未支持) * - speech: 声纹识别(暂未支持) */ authMode: SoterAuthMode, /** * 在设备安全区域(TEE)内获得的本机安全信息以及本次认证信息 */ resultJSON?: string | null, /** * 用SOTER安全密钥对 resultJSON 的签名(SHA256 with RSA/PSS, saltlen=20) */ resultJSONSignature?: string | null, /** * 接口调用结果 */ errMsg: string }; export type StartSoterAuthenticationSuccessCallback = (result: StartSoterAuthenticationSuccess) => void; export type StartSoterAuthenticationFail = UniError; export type UniError = { errSubject: string, errCode: number, errMsg: string, data?: object | null, cause?: any | null }; export type StartSoterAuthenticationFailCallback = (result: StartSoterAuthenticationFail) => void; export type StartSoterAuthenticationComplete = any; export type StartSoterAuthenticationCompleteCallback = (result: StartSoterAuthenticationComplete) => void; export type StartSoterAuthenticationOptions = { /** * 请求使用的可接受的生物认证方式 */ requestAuthModes: SoterAuthMode[], /** * 挑战因子 */ challenge?: string | null, /** * 验证描述,即识别过程中显示在界面上的对话框提示内容 */ authContent?: string | null, /** * 接口调用成功的回调函数 */ success?: StartSoterAuthenticationSuccessCallback | null, /** * 接口调用失败的回调函数 */ fail?: StartSoterAuthenticationFailCallback | null, /** * 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: StartSoterAuthenticationCompleteCallback | null }; export type CheckIsSupportSoterAuthentication = (options: CheckIsSupportSoterAuthenticationOptions) => void; export type CheckIsSupportSoterAuthenticationSuccess = { /** * 接口调用成功的回调函数 */ supportMode: SoterAuthMode[], /** * 接口调用结果 */ errMsg: string }; export type CheckIsSupportSoterAuthenticationSuccessCallback = (result: CheckIsSupportSoterAuthenticationSuccess) => void; export type CheckIsSupportSoterAuthenticationFail = UniError; export type CheckIsSupportSoterAuthenticationFailCallback = (result: CheckIsSupportSoterAuthenticationFail) => void; export type CheckIsSupportSoterAuthenticationComplete = any; export type CheckIsSupportSoterAuthenticationCompleteCallback = (result: CheckIsSupportSoterAuthenticationComplete) => void; export type CheckIsSupportSoterAuthenticationOptions = { /** * 接口调用成功的回调函数 */ success?: CheckIsSupportSoterAuthenticationSuccessCallback | null, /** * 接口调用失败的回调函数 */ fail?: CheckIsSupportSoterAuthenticationFailCallback | null, /** * 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: CheckIsSupportSoterAuthenticationCompleteCallback | null }; export type CheckIsSoterEnrolledInDevice = (options: CheckIsSoterEnrolledInDeviceOptions) => void; export type CheckIsSoterEnrolledInDeviceSuccess = { /** * 是否已录入信息 * @type boolean */ isEnrolled: boolean, /** * 错误信息 */ errMsg: string }; export type CheckIsSoterEnrolledInDeviceSuccessCallback = (result: CheckIsSoterEnrolledInDeviceSuccess) => void; export type CheckIsSoterEnrolledInDeviceFail = UniError; export type CheckIsSoterEnrolledInDeviceFailCallback = (result: CheckIsSoterEnrolledInDeviceFail) => void; export type CheckIsSoterEnrolledInDeviceComplete = any; export type CheckIsSoterEnrolledInDeviceCompleteCallback = (result: CheckIsSoterEnrolledInDeviceComplete) => void; export type CheckIsSoterEnrolledInDeviceOptions = { /** * 生物认证方式 * - fingerPrint: 指纹识别 * - facial: 人脸识别(暂未支持) * - speech: 声纹识别(暂未支持) */ checkAuthMode: SoterAuthMode, /** * 接口调用成功的回调函数 */ success?: CheckIsSoterEnrolledInDeviceSuccessCallback | null, /** * 接口调用失败的回调函数 */ fail?: CheckIsSoterEnrolledInDeviceFailCallback | null, /** * 接口调用结束的回调函数(调用成功、失败都会执行) */ complete?: CheckIsSoterEnrolledInDeviceCompleteCallback | null };