Step by Step Integration for Huawei FIDO BioAuthn-AndroidX

Mustafa SARITEMUR
Huawei Developers
Published in
3 min readMar 9, 2021

What is FIDO BioAuthn

FIDO provides your app with powerful local biometric authentication capabilities, including fingerprint authentication and 3D facial authentication. It allows your app to provide secure and easy-to-use password-free authentication for users while ensuring reliable authentication results.

Service Features

· Takes the system integrity check result as the prerequisite for using BioAuthn, ensuring more secure authentication.

· Uses cryptographic key verification to ensure the security and reliability of authentication results.

Requirements

· Android Studio version: 3.X or later

· Test device: a Huawei phone running EMUI 10.0 or later

Configurations

For the step by step tutorial follow this link for integrating Huawei HMS Core: link

When you finish those steps you need to add below code to your build.gradle file under app directory of your project.

*Current latest version: 5.0.5.304

After that, add bellow lines to your proguard-rules.pro in the app directory of your project.

Sync project and you are ready to go.

Development

1 - We need to add permissions to the AndroidManifest.xml.

2 - Create two buttons for fingerprint authentication and face recognition.

3 - First let’s ask for Camera permission on onResume method of activity.

4 - Create a function that returns BioAuthnCallback object for later use.

5 - So far we implemented requirements. Now we can implement Fingerprint authentication button onClick method.

The user will first be prompted to authenticate with biometrics, but also given the option to authenticate with their device PIN, pattern, or password. setNegativeButtonText(CharSequence) should not be set if setDeviceCredentialAllowed(boolean) set to true vice versa.

Huawei provides the secure fingerprint authentication capability. If the system is insecure, the callback method BioAuthnCallback.onAuthError() returns the error code BioAuthnPrompt.ERROR_SYS_INTEGRITY_FAILED (Code: 1001). If the system is secure, fingerprint authentication is performed.

6 - Now we can also implement face recognition button’s onPress method.

You are advised to set CryptoObject to null. KeyStore is not associated with face authentication in the current version. KeyGenParameterSpec.Builder.setUserAuthenticationRequired() must be set to false in this scenario.

Huawei provides the secure 3D facial authentication capability. If the system is insecure, the callback method BioAuthnCallback.onAuthError returns the error code FaceManager.FACE_ERROR_SYS_INTEGRITY_FAILED (Code: 1001). If the system is secure, 3D facial authentication is performed.

7 - For the last part lets implement showResult method that we used on bioAuthCallback method to keep log of the operations and show a toast message.

ou can shape showResult method like you can proceed to another activity-fragment or whatever you want your application to do.

With all set you are ready to implement Huawei FIDO BioAuthn to your application.

Conclusion

With this article you can learn what Huawei FIDO BioAuthn is and with the step by step implementation it will be very easy to use it on your code.

For more information about Huawei FIDO:

Thank you.

--

--