GithubHelp home page GithubHelp logo

biometric's Introduction

Biometric-Auth

Add Biometric Authentication to any Android app

This library based on https://github.com/anitaa1990/Biometric-Auth-Sample. It is kotlin version with some improvements.

This library provides an easy way to implement fingerprint authentication without having to deal with all the boilerplate stuff going on inside.

API

How to integrate the library in your app?

Gradle Dependecy
dependencies {
        implementation 'pro.devapp.biometric:biometric:1.0.0'
}

Usage

val dialogV23: BiometricDialogV23Interface = ....
        BiometricManager(
            this@MainActivity,
            "Title",
            "Subtitle example",
            "Description example",
            "Cancel",
            "Error text",
            dialogV23
        ).authenticate(biometricCallback)

The BiometricDialogV23Interface interface for dialog to support devices before BiometricPrompt. You can found implementation in example app

The BiometricCallback class has the following callback methods:

BiometricCallback {
              override fun onSdkVersionNotSupported() {
                     /*  
                      *  Will be called if the device sdk version does not support Biometric authentication
                      */
               }

               override fun onBiometricAuthenticationNotSupported() {
                     /*  
                      *  Will be called if the device does not contain any fingerprint sensors 
                      */
               }

               override fun  onBiometricAuthenticationNotAvailable() {
                    /*  
                     *  The device does not have any biometrics registered in the device.
                     */
               }

               override fun onBiometricAuthenticationPermissionNotGranted() {
                      /*  
                       *  android.permission.USE_BIOMETRIC permission is not granted to the app
                       */
               }

                override fun onBiometricAuthenticationInternalError(error: String) {
                     /*  
                      *  This method is called if one of the fields such as the title, subtitle, 
                      * description or the negative button text is empty
                      */
               }

               override fun  onAuthenticationFailed() {
                      /*  
                       * When the fingerprint doesn’t match with any of the fingerprints registered on the device, 
                       * then this callback will be triggered.
                       */
               }

               override fun  onAuthenticationCancelled() {
                       /*  
                        * The authentication is cancelled by the user. 
                        */
               }

               override fun  onAuthenticationSuccessful() {
                        /*  
                         * When the fingerprint is has been successfully matched with one of the fingerprints   
                         * registered on the device, then this callback will be triggered. 
                         */
               }

               override fun  onAuthenticationHelp(helpCode: Int, helpString: CharSequence) {
                         /*  
                          * This method is called when a non-fatal error has occurred during the authentication 
                          * process. The callback will be provided with an help code to identify the cause of the 
                          * error, along with a help message.
                          */
                }

               override fun  onAuthenticationError(errorCode: Int, errString: CharSequence) {
                         /*  
                          * When an unrecoverable error has been encountered and the authentication process has 
                          * completed without success, then this callback will be triggered. The callback is provided 
                          * with an error code to identify the cause of the error, along with the error message. 
                          */
                 }
              })

biometric's People

Contributors

devapro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

godswilleffiong

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.