目录

CLASS info
public class BioAuthnPrompt extends java.lang.Object
Represents a main entry point for the fingerprint authentication API of FIDO BioAuthn.

Constant Summary

TypeNameDesc
intERROR_HW_UNAVAILABLEHardware is unavailable. Try again later.
intERROR_UNABLE_TO_PROCESSThe sensor cannot process the current fingerprint image.
intERROR_TIMEOUTThe current request timed out.
intERROR_NO_SPACEThe storage space is insufficient for the operation.
intERROR_CANCELEDThe operation is canceled because the fingerprint authentication sensor is unavailable.
intERROR_LOCKOUTThe operation is canceled because the API is locked when the number of attempts reaches the maximum.
intERROR_VENDORVendor-defined errors.
intERROR_LOCKOUT_PERMANENTThe operation is canceled when the number of fingerprint authentication locking times reaches the maximum.
intERROR_USER_CANCELEDThe user cancels the fingerprint authentication.
intERROR_NO_BIOMETRICSThe user has not registered any fingerprints.
intERROR_HW_NOT_PRESENTThe user device is not equipped with a fingerprint sensor.
intERROR_NEGATIVE_BUTTONThe user cancels the authentication.
intERROR_NO_DEVICE_CREDENTIALNo PIN or password is set for the device.
intERROR_SYS_INTEGRITY_FAILEDThe device failed the system integrity check.
intERROR_CRYPTO_VERIFY_FAILEDThe fingerprint authentication result failed the key-based encryption certification.
intERROR_HMS_FRAMEWORK_ERRORHMS Core Framework error.
intERROR_UNSUPPORTED_OS_VERThis version of operating system does not support fingerprint authentication.

Public Constructor Summary

Method name

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

Constructs a BioAuthnPrompt object for fingerprint authentication, which is used to call the fingerprint authentication API of FIDO BioAuthn.

BioAuthnPrompt(androidx.fragment.app.Fragment fragment, java.util.concurrent.Executor executor, BioAuthnCallback callback)Constructs a BioAuthnPrompt object for fingerprint authentication, which is used to call the fingerprint authentication API of FIDO BioAuthn.

Public Method Summary

Return typeMethod name
void

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

Displays a fingerprint authentication pop-up for the user. Associates with a private key or a public-private key pair, which can be used only after the user passes the fingerprint authentication.

void

auth(final BioAuthnPrompt.PromptInfo info)

Displays a fingerprint authentication pop-up for users.

void

cancelAuth()

Closes the fingerprint authentication pop-up.

Constants

Constant
public static final int ERROR_HW_UNAVAILABLE

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 1

Hardware is unavailable. Try again later.

Constant
public static final int ERROR_UNABLE_TO_PROCESS

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 2

The sensor cannot process the current fingerprint image.

Constant
public static final int ERROR_TIMEOUT

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 3

The current request timed out. The timeout mechanism prevents infinite waiting for the fingerprint sensor’s response. The timeout interval varies depending on the user device and sensor. Generally, the timeout interval is 30 seconds.

Constant
public static final int ERROR_NO_SPACE

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 4

The storage space is insufficient for operations such as registration.

Constant
public static final int ERROR_CANCELED

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 5

The operation is canceled because the fingerprint authentication sensor is unavailable.

Constant
public static final int ERROR_LOCKOUT

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 7

The operation is canceled because the API is locked when the number of attempts reaches the maximum. The API is locked for 30 seconds after five consecutive attempt failures.

Constant
public static final int ERROR_VENDOR

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 8

Vendor-defined errors.

Constant
public static final int ERROR_LOCKOUT_PERMANENT

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 9

The operation is canceled when the number of fingerprint authentication locking times reaches the maximum. Then, fingerprint authentication is disabled until the user is authenticated in a stronger authentication mode, including PIN and password authentication.

Constant
public static final int ERROR_USER_CANCELED

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 10

The user cancels the fingerprint authentication. After receiving this error code, the app enables the standby authentication mode, for example, password authentication. The app also needs to provide the fingerprint authentication enabling method, for example, a button.

Constant
public static final int ERROR_NO_BIOMETRICS

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 11

The user has not registered any fingerprints.

Constant
public static final int ERROR_HW_NOT_PRESENT

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 12

The user device is not equipped with a fingerprint sensor.

Constant
public static final int ERROR_NEGATIVE_BUTTON

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 13

The user cancels the authentication.

Constant
public static final int ERROR_NO_DEVICE_CREDENTIAL

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 14

No PIN or password is set for the device.

Constant
public static final int ERROR_SYS_INTEGRITY_FAILED

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 1001

The device failed the system integrity check, for example, the device has been rooted, the device ROM has been flashed, or the system has been damaged.

Constant
public static final int ERROR_CRYPTO_VERIFY_FAILED

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 1002

The fingerprint authentication result failed the key-based encryption certification.

Constant
public static final int ERROR_HMS_FRAMEWORK_ERROR

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 1003

HMS Core Framework error.

Constant
public static final int ERROR_UNSUPPORTED_OS_VER

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called.

Value: 1004

This version of operating system does not support fingerprint authentication. The EMUI version of a user device supporting fingerprint authentication of FIDO BioAuthn must be 5.0.0 or later.

Public Constructors

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

Parameters

Parameter nameParameter desc
fragmentActivityFragmentActivity of an Android app.
executorExecutor for processing the callback event.
callbackCallback object for processing the authentication event.
Method
public BioAuthnPrompt(androidx.fragment.app.Fragment fragment, java.util.concurrent.Executor executor, BioAuthnCallback callback)

Parameters

Parameter nameParameter desc
fragmentFragment of an Android app.
executorExecutor for processing the callback event.
callbackCallback object for processing the authentication event.

Public Methods

Method
public void auth(final BioAuthnPrompt.PromptInfo info, final CryptoObject crypto)
Displays a fingerprint authentication pop-up for users. This method is associated with a private key or a public-private key pair, which can be used only after the user passes the fingerprint authentication.

Parameters

Parameter nameParameter desc
infoInformation displayed in the fingerprint authentication pop-up, which is created using BioAuthnPrompt.PromptInfo.Builder.
cryptoEncryption object associated with fingerprint authentication.
Method
public void auth(final BioAuthnPrompt.PromptInfo info)
Displays a fingerprint authentication pop-up for users.

Parameters

Parameter nameParameter desc
infoInformation displayed in the fingerprint authentication pop-up, which is created using BioAuthnPrompt.PromptInfo.Builder.
Method
public void cancelAuth()
Closes the fingerprint authentication pop-up.