cake_wallet/lib/entities/biometric_auth.dart

33 lines
776 B
Dart
Raw Permalink Normal View History

import 'package:local_auth/local_auth.dart';
import 'package:flutter/services.dart';
import 'package:cake_wallet/generated/i18n.dart';
class BiometricAuth {
2020-09-10 14:51:59 +00:00
final _localAuth = LocalAuthentication();
Future<bool> isAuthenticated() async {
try {
return await _localAuth.authenticate(
localizedReason: S.current.biometric_auth_reason,
2022-10-12 17:09:57 +00:00
options: AuthenticationOptions(
biometricOnly: true,
2022-10-12 17:09:57 +00:00
useErrorDialogs: true,
stickyAuth: false));
2020-09-10 14:51:59 +00:00
} on PlatformException catch (e) {
print(e);
}
return false;
}
2020-09-10 14:51:59 +00:00
Future<bool> canCheckBiometrics() async {
try {
return await _localAuth.canCheckBiometrics;
} on PlatformException catch (e) {
print(e);
}
return false;
}
}