interface.uts 5.6 KB
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171

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
};