目录

CLASS info
public class BioAuthnPrompt extends java.lang.Object
FIDO BioAuthn指纹认证API的主入口

Constant Summary

TypeNameDesc
intERROR_HW_UNAVAILABLE硬件不可用。请稍后再试。
intERROR_UNABLE_TO_PROCESS当传感器无法处理当前图像时返回错误状态。
intERROR_TIMEOUT当前请求运行太久时返回错误状态。
intERROR_NO_SPACE没有足够的存储空间来完成操作。
intERROR_CANCELED由于指纹认证传感器不可用,操作被取消。
intERROR_LOCKOUT由于尝试次数太多,API被锁定,操作被取消。
intERROR_VENDOR厂商自定义错误。
intERROR_LOCKOUT_PERMANENT因为错误锁定发生的次数太多,操作被取消。
intERROR_USER_CANCELED用户取消了操作。
intERROR_NO_BIOMETRICS用户没有注册任何指纹。
intERROR_HW_NOT_PRESENT设备没有指纹传感器。
intERROR_NEGATIVE_BUTTON用户按下了否定按钮。
intERROR_NO_DEVICE_CREDENTIAL设备没有设置PIN码、图形解锁或密码。
intERROR_SYS_INTEGRITY_FAILED系统完整性检查失败。
intERROR_CRYPTO_VERIFY_FAILED使用密钥加密验证认证结果失败。
intERROR_HMS_FRAMEWORK_ERRORHMS Core框架错误。
intERROR_UNSUPPORTED_OS_VER操作系统版本不支持指纹认证。

Public Constructor Summary

Method name

BioAuthnPrompt(androidx.fragment.app.FragmentActivity fragmentActivity, java.util.concurrent.Executor executor, BioAuthnCallback callback)

构造一个用户可用于指纹认证的BioAuthnPrompt对象,这个对象用于调用 FIDO BioAuthn指纹认证API。

BioAuthnPrompt(androidx.fragment.app.Fragment fragment, java.util.concurrent.Executor executor, BioAuthnCallback callback)

构造一个用户可用于指纹认证的BioAuthnPrompt对象,这个对象用于调用 FIDO BioAuthn指纹认证API。

Public Method Summary

Return typeMethod name
void

auth(final BioAuthnPrompt.PromptInfo info, final CryptoObject crypto)

展示一个指纹认证提示窗口,提示用户进行指纹认证。此方法关联一个秘钥或公私钥对,当指纹认证通过后才能使用关联的秘钥或公私钥对。

void

auth(final BioAuthnPrompt.PromptInfo info)

展示一个指纹认证提示窗口,提示用户进行指纹认证。

void

cancelAuth()

取消展示指纹认证提示窗口。

Constants

Constant
public static final int ERROR_HW_UNAVAILABLE

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 1

硬件不可用。请稍后再试。

Constant
public static final int ERROR_UNABLE_TO_PROCESS

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 2

当传感器无法处理当前图像时返回错误状态。

Constant
public static final int ERROR_TIMEOUT

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 3

当前请求运行太久时返回错误状态。这是为了防止程序无限期地等待指纹传感器。超时是特定于平台和传感器的,但通常为30秒。

Constant
public static final int ERROR_NO_SPACE

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 4

为注册等操作返回错误状态;操作无法完成,因为没有足够的存储空间来完成该操作。

Constant
public static final int ERROR_CANCELED

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 5

由于指纹认证传感器不可用,操作被取消。

Constant
public static final int ERROR_LOCKOUT

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 7

由于尝试次数太多,API被锁定,操作被取消。这发生在5次失败的尝试之后,持续30秒。

Constant
public static final int ERROR_VENDOR

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 8

厂商自定义错误。

Constant
public static final int ERROR_LOCKOUT_PERMANENT

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 9

操作被取消,因为错误锁定发生的次数太多。在用户使用强认证(PIN/Pattern/Password)解锁之前,指纹认证将被禁用

Constant
public static final int ERROR_USER_CANCELED

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 10

用户取消了操作。收到此消息后,应用程序应使用备用认证(例如密码)。应用程序还应提供返回指纹认证的方法,如“使用”按钮。

Constant
public static final int ERROR_NO_BIOMETRICS

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 11

用户没有注册任何指纹。

Constant
public static final int ERROR_HW_NOT_PRESENT

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 12

设备没有指纹传感器。

Constant
public static final int ERROR_NEGATIVE_BUTTON

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 13

用户按下了否定按钮。

Constant
public static final int ERROR_NO_DEVICE_CREDENTIAL

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 14

设备没有设置PIN码、图形解锁或密码。

Constant
public static final int ERROR_SYS_INTEGRITY_FAILED

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 1001

系统完整性检查失败,比如设备已root、被刷机,或系统被破坏。

Constant
public static final int ERROR_CRYPTO_VERIFY_FAILED

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 1002

使用密钥加密验证认证结果失败。

Constant
public static final int ERROR_HMS_FRAMEWORK_ERROR

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 1003

HMS Core框架错误。

Constant
public static final int ERROR_UNSUPPORTED_OS_VER

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 1004

操作系统版本不支持指纹认证。支持FIDO BioAuthn指纹认证的设备需满足 EMUI >=5.0.0

Public Constructors

Method
public BioAuthnPrompt(androidx.fragment.app.FragmentActivity fragmentActivity, java.util.concurrent.Executor executor, BioAuthnCallback callback)

Parameters

Parameter nameParameter desc
fragmentActivity安卓应用的 FragmentActivity,对客户端的activity的引用。
executor处理回调事件的执行器。
callback用于处理认证事件的回调对象。
Method
public BioAuthnPrompt(androidx.fragment.app.Fragment fragment, java.util.concurrent.Executor executor, BioAuthnCallback callback)

Parameters

Parameter nameParameter desc
fragment安卓应用的 Fragment,对客户端的fragment的引用。
executor处理回调事件的执行器。
callback用于处理认证事件的回调对象。

Public Methods

Method
public void auth(final BioAuthnPrompt.PromptInfo info, final CryptoObject crypto)
展示一个指纹认证提示窗口,提示用户进行指纹认证。此方法关联一个秘钥或公私钥对,当指纹认证通过后才能使用关联的秘钥或公私钥对。

Parameters

Parameter nameParameter desc
info将在提示中显示的信息,使用BioAuthnPrompt.PromptInfo.Builder创建这个对象。
crypto与指纹认证关联的加密对象。
Method
public void auth(final BioAuthnPrompt.PromptInfo info)
展示一个指纹认证提示窗口,提示用户进行指纹认证。

Parameters

Parameter nameParameter desc
info将在提示中显示的信息,使用BioAuthnPrompt.PromptInfo.Builder创建这个对象。
Method
public void cancelAuth()
取消展示指纹认证提示窗口
CLASS info
public abstract class BioAuthnCallback extends java.lang.Object
提供给BioAuthn指纹认证或面容认证的结果回调。需要由开发者完成具体实现。