biometricx

Last updated:

0 purchases

biometricx Image
biometricx Images
Add to Cart

Description:

biometricx

BiometricX #
The easy way to use biometric authentication in your Flutter app.
Supports Fingerprint, FaceID and Iris.
Demo APK.

Starting #
$ flutter pub add biometricx
copied to clipboard
Configuration #
Change your android MainActivity to extends FlutterFragmentActivity.
import io.flutter.embedding.android.FlutterFragmentActivity

// kotlin
class MainActivity: FlutterFragmentActivity() {
...
}
copied to clipboard
import io.flutter.embedding.android.FlutterFragmentActivity;

// java
class MainActivity extends FlutterFragmentActivity {
...
}
copied to clipboard
Usage #
To check biometric type of your device.
BiometricType type = await BiometricX.type;
copied to clipboard
Here is the list of biometric types.
BiometricType.FACE
BiometricType.FINGERPRINT
BiometricType.IRIS
BiometricType.MULTIPLE
BiometricType.NONE
BiometricType.NO_HARDWARE
BiometricType.UNAVAILABLE
BiometricType.UNSUPPORTED
copied to clipboard
To check if your device can use biometric authentication.
bool isBiometricEnabled = await BiometricX.isEnabled;
copied to clipboard
To encrypt data using biometric authentication.
BiometricResult result = await BiometricX.encrypt({
biometricKey: 'salkuadrat',
message: 'This is a very secret message',
});

if (result.isSuccess && result.hasData) {
// Keep this messageKey to decrypt your message.
// This messageKey will be randomly generated by BiometricX plugin.
String messageKey = result.data!;
} else {
showToast(result.errorMsg, context: context);
}
copied to clipboard
If you need a persistent messageKey, you can supply it as parameter to encrypt.
BiometricResult result = await BiometricX.encrypt({
biometricKey: 'salkuadrat',
messageKey: 'secret_message', // use persistent messageKey
message: 'This is a very secret message',
});

if (result.isSuccess && result.hasData) {
// Keep this messageKey to decrypt your message.
// This will be the same value as messageKey above ('secret_message')
String messageKey = result.data!;
} else {
showToast(result.errorMsg, context: context);
}
copied to clipboard
To decrypt data using biometric authentication.
// Use the same biometricKey that is used to encrypt your message.
// Use messageKey that you get from [BiometricX.encrypt].
BiometricResult result = await BiometricX.decrypt({
biometricKey: 'salkuadrat',
messageKey: messageKey,
});

if (result.isSuccess && result.hasData) {
// This will contains your original message.
String message = result.data!;
} else {
showToast(result.errorMsg, context: context);
}
copied to clipboard
To show custom message in your biometric prompt, method encrypt and decrypt have parameters you can use to change the biometric prompt dialog.
BiometricResult result = await BiometricX.encrypt({
biometricKey: 'salkuadrat',
message: 'This is a very secret message',
title: 'Biometric Encryption',
subtitle: 'Enter biometric credentials to encrypt your message',
description: 'Scan fingerprint or face.',
negativeButtonText: 'USE PASSWORD',
confirmationRequired: true,
});
copied to clipboard
BiometricResult message = await BiometricX.decrypt({
biometricKey: 'salkuadrat',
messageKey: messageKey,
title: 'Biometric Decryption',
subtitle: 'Enter biometric credentials to decrypt your message',
description: 'Scan fingerprint or face.',
negativeButtonText: 'USE PASSWORD',
confirmationRequired: true,
});
copied to clipboard
Example #
Example project.
Demo APK.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.