Class BiometricUtil


  • public class BiometricUtil
    extends java.lang.Object
    Helper class when using biometrics
    • Constructor Summary

      Constructors 
      Constructor Description
      BiometricUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void decryptString​(java.lang.String cipherText, DecryptPasswordListener decryptPasswordListener)
      Decrypts text and notifies the DecryptPasswordListener listener
      static void encryptString​(android.content.Context context, javax.crypto.Cipher cipher, java.lang.String initialText, java.lang.String email)
      Encrypts the text given with the algorithm indicated in the cipher Then, saved the encrypted password and email to shared preferences
      static boolean hasBiometrics​(android.app.Activity activity)
      Check if device has biometrics data,capable of biometrics as well as biometrics login enabled on the app
      static boolean hasBiometricsSettings​(android.app.Activity activity)
      Check if device can do biometric authentication and is enabled on the app
      static boolean isBiometricAuthenticationCapable​(android.app.Activity activity)
      Check if device can do fingerprint authentication
      static boolean isBiometricsEnabled​(android.content.Context mContext)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BiometricUtil

        public BiometricUtil()
    • Method Detail

      • encryptString

        public static void encryptString​(android.content.Context context,
                                         javax.crypto.Cipher cipher,
                                         java.lang.String initialText,
                                         java.lang.String email)
        Encrypts the text given with the algorithm indicated in the cipher Then, saved the encrypted password and email to shared preferences
        Parameters:
        context - used to get resources
        cipher - Cipher used for encryption
        initialText - Text to be encrypted
        email - Email of the user
      • decryptString

        public static void decryptString​(java.lang.String cipherText,
                                         DecryptPasswordListener decryptPasswordListener)
        Decrypts text and notifies the DecryptPasswordListener listener
        Parameters:
        cipherText - Encrypted text
        decryptPasswordListener - callback on password decryption
      • hasBiometrics

        public static boolean hasBiometrics​(android.app.Activity activity)
        Check if device has biometrics data,capable of biometrics as well as biometrics login enabled on the app
        Parameters:
        activity - Activity reference used for biometric settings
        Returns:
        true if Biometrics configuration is satisfied, else false
      • isBiometricsEnabled

        public static boolean isBiometricsEnabled​(android.content.Context mContext)
        Parameters:
        mContext - used to access shared preference value for biometrics
        Returns:
        true if biometrics is enabled, else false
      • hasBiometricsSettings

        public static boolean hasBiometricsSettings​(android.app.Activity activity)
        Check if device can do biometric authentication and is enabled on the app
        Parameters:
        activity - used to access shared preference value for biometrics
        Returns:
        true if has biometric settings else false
      • isBiometricAuthenticationCapable

        public static boolean isBiometricAuthenticationCapable​(android.app.Activity activity)
        Check if device can do fingerprint authentication
        Parameters:
        activity - used to show dialog
        Returns:
        true is biometric authentication is capable, else false