encrypt static method
Future<BiometricResult>
encrypt({
- required String biometricKey,
- required String message,
- String messageKey = '',
- String title = 'Biometric Authentication',
- String subtitle = 'Enter biometric credentials to proceed',
- String description = '',
- String negativeButtonText = 'CANCEL',
- bool confirmationRequired = false,
- bool deviceCredentialAllowed = false,
Encrypt message using biometric.
Implementation
static Future<BiometricResult> encrypt({
required String biometricKey,
required String message,
String messageKey = '',
String title = 'Biometric Authentication',
String subtitle = 'Enter biometric credentials to proceed',
String description = '',
String negativeButtonText = 'CANCEL',
bool confirmationRequired = false,
bool deviceCredentialAllowed = false,
}) async {
try {
final resultKey = await _channel.invokeMethod('encrypt', {
'biometric_key': biometricKey,
'message_key': messageKey,
'message': message,
'title': title,
'subtitle': subtitle,
'description': description,
'negative_button_text': negativeButtonText,
'confirmation_required': confirmationRequired,
'device_credential_allowed': deviceCredentialAllowed,
});
if (resultKey is String) {
return BiometricResult(
status: BiometricStatus.SUCCESS,
data: resultKey,
);
} else {
final bmType = await type;
return BiometricResult(
status: BiometricStatus.FAILED,
type: bmType,
);
}
} on Exception {
return BiometricResult(status: BiometricStatus.CANCELED);
}
}