Class BiometricUtil
- java.lang.Object
-
- com.cheetahdigital.authentication.ui.biometrics.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 theDecryptPasswordListener
listenerstatic 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 preferencesstatic boolean
hasBiometrics(android.app.Activity activity)
Check if device has biometrics data,capable of biometrics as well as biometrics login enabled on the appstatic boolean
hasBiometricsSettings(android.app.Activity activity)
Check if device can do biometric authentication and is enabled on the appstatic boolean
isBiometricAuthenticationCapable(android.app.Activity activity)
Check if device can do fingerprint authenticationstatic boolean
isBiometricsEnabled(android.content.Context mContext)
Check ifBiometricsSharedPrefs.ENABLE_BIOMETRICS
is enabled
-
-
-
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 resourcescipher
-Cipher
used for encryptioninitialText
- Text to be encryptedemail
- Email of the user
-
decryptString
public static void decryptString(java.lang.String cipherText, DecryptPasswordListener decryptPasswordListener)
Decrypts text and notifies theDecryptPasswordListener
listener- Parameters:
cipherText
- Encrypted textdecryptPasswordListener
- 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)
Check ifBiometricsSharedPrefs.ENABLE_BIOMETRICS
is enabled- 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
-
-