

English
生物认证,包含手机的指纹识别、faceid两部分。即通过人体身体特征来进行身份认证识别。
如需要专业的活体检测、人脸识别、金融级实人认证,需另见文档uni实人认证
Start the SOTER biometric authentication.
Platform difference description
App | H5 | 微信小程序 | 支付宝小程序 | 百度小程序 | 抖音小程序、飞书小程序 | QQ小程序 | 元服务 | 小红书小程序 |
---|---|---|---|---|---|---|---|---|
√(2.3.8+) | x | √ | x | x | x | x | x | x |
HarmonyOS |
---|
HBuilderX 4.31 |
OBJECT parameter description
Properties | Type | Default | Required | Description | Platform Difference Description |
---|---|---|---|---|---|
requestAuthModes | Array | 是 | 请求使用的可接受的生物认证方式 | APP、微信小程序 | |
challenge | String | 是 | 挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 resultJSON 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。 | 微信小程序、HarmonyOS Next | |
authContent | String | '' | No | Authentication description, that is, the dialog prompt content displayed on the interface during the recognition process | APP, WeChat applet |
success | Function | No | Callback function for successful interface call | ||
fail | Function | No | Callback function for interface call failure | ||
complete | Function | No | The callback function for the end of the interface call (the call will be executed if the call succeeds or fails) |
OBJECT.requestAuthModes description
Value | Instruction |
---|---|
fingerPrint | Fingerprint identification |
facial | Face identification |
Description of return value of OBJECT.success
Properties | Type | Description | Platform Difference Description |
---|---|---|---|
authMode | string | Biometric authentication method | APP, WeChat applet |
resultJSON | string | The local security information (such as TEE name, version number, etc., and anti-replay parameters) obtained in the device security area (TEE) and this authentication information (only supported by Android, the fingerprint ID of this authentication). See below for specific instructions | WeChat Mini Program |
resultJSONSignature | string | Sign resultJSON with SOTER security key (SHA256 with RSA/PSS, saltlen=20) | WeChat applet |
errCode | number | Error code | |
errMsg | string | Error message |
resultJSON description
This data is JSON assembled from the incoming challenge and other security information in the TEE in the device TEE. The following table explains the following fields. Examples are as follows:
Field Name | Description |
---|---|
raw | challenge passed in by the caller |
fid | (Only supported by Android) The biometric information number of this biometric authentication (for fingerprint recognition, the fingerprint information is the internal number of the device) |
counter | Anti-replay feature parameter |
tee_n | TEE name (such as Qualcomm or trustonic, etc.) |
tee_v | TEE version number |
fp_n | Fingerprint and related logic module providers (such as FPC, etc.) |
fp_v | fingerprint and related module version numbers |
cpu_id | Machine Unique ID |
uid | The concept is the same as the Android system definition uid, that is, the application number |
Error code description
Error code | Error code description |
---|---|
0 | Identification successful |
90001 | This device does not support biometric authentication. |
90002 | The user is not authorized to use the biometric authentication interface |
90003 | The requested biometric authentication method is not supported |
90004 | No challenge was passed in or the length of the challenge is too long (the maximum length is 512 characters) |
90005 | auth_content length exceeds the limit (the maximum is 42 characters) |
90007 | Internal error |
90008 | User authorization cancellation |
90009 | Identification failed |
90010 | Blocked due to too many retries |
90011 | User has not entered the selected identification method. |
注意
Obtain the supported SOTER biometric authentication mode
HarmonyOS |
---|
HBuilderX 4.31 |
OBJECT parameter description
Attribute | Type | Defaults | Required | Instruction |
---|---|---|---|---|
success | function | No | Callback function for successful interface calling | |
fail | function | No | Callback function for failed interface calling | |
complete | function | No | Callback function for closed interface calling (available both for successful and failed calling) |
Description of return value of OBJECT.success
Attribute | Type | Instruction |
---|---|---|
supportMode | Array | Biometrics supported by this device that can be recognized by SOTER |
WARNING
HarmonyOS Next
平台使用时需要添加权限 ohos.permission.ACCESS_BIOMETRIC
HarmonyOS |
---|
HBuilderX 4.31 |
Interface for requesting whether biological information such as fingerprints are entered in the device
OBJECT parameter description
Attribute | Type | Defaults | Required | Instruction |
---|---|---|---|---|
checkAuthMode | string | Yes | Verification method | |
success | function | No | Callback function for successful interface calling | |
fail | function | No | Callback function for failed interface calling | |
complete | function | No | Callback function for closed interface calling (available both for successful and failed calling) |
OBJECT.checkAuthMode legal values
Value | Instruction |
---|---|
fingerPrint | Fingerprint identification |
facial | Face identification |
Description of return value of OBJECT.success
Attribute | Type | Instruction |
---|---|---|
isEnrolled | boolean | Whether the information has been entered |
errMsg | string | Error message |
WARNING
HarmonyOS Next
平台使用时需要添加权限 ohos.permission.ACCESS_BIOMETRIC
<template>
<view class="content">
<button type="primary" @click="checkIsSupportSoterAuthentication">检查支持的认证方式</button>
<button type="primary" @click="checkIsSoterEnrolledInDeviceFingerPrint">检查是否录入指纹</button>
<button type="primary" @click="checkIsSoterEnrolledInDeviceFaceID">检查是否录入FaceID</button>
<button type="primary" @click="startSoterAuthenticationFingerPrint">开始指纹认证</button>
<button type="primary" @click="startSoterAuthenticationFaceID">开始FaceID认证</button>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {
},
methods: {
checkIsSupportSoterAuthentication() {
uni.checkIsSupportSoterAuthentication({
success(res) {
console.log(res);
},
fail(err) {
console.log(err);
},
complete(res) {
console.log(res);
}
})
},
checkIsSoterEnrolledInDeviceFingerPrint() {
uni.checkIsSoterEnrolledInDevice({
checkAuthMode: 'fingerPrint',
success(res) {
console.log(res);
},
fail(err) {
console.log(err);
},
complete(res) {
console.log(res);
}
})
},
checkIsSoterEnrolledInDeviceFaceID() {
uni.checkIsSoterEnrolledInDevice({
checkAuthMode: 'facial',
success(res) {
console.log(res);
},
fail(err) {
console.log(err);
},
complete(res) {
console.log(res);
}
})
},
startSoterAuthenticationFingerPrint() {
uni.startSoterAuthentication({
requestAuthModes: ['fingerPrint'],
challenge: '123456',
success(res) {
console.log(res);
},
fail(err) {
console.log(err);
},
complete(res) {
console.log(res);
}
})
},
startSoterAuthenticationFaceID() {
uni.startSoterAuthentication({
requestAuthModes: ['facial'],
challenge: '123456',
success(res) {
console.log(res);
},
fail(err) {
console.log(err);
},
complete(res) {
console.log(res);
}
})
}
}
}
</script>
<style>
button {
width: 200px;
margin: 20px auto;
}
</style>