mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 17:57:36 +00:00
30 lines
710 B
Dart
30 lines
710 B
Dart
import 'package:local_auth/local_auth.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
class BiometricAuth {
|
|
final _localAuth = LocalAuthentication();
|
|
|
|
Future<bool> isAuthenticated() async {
|
|
try {
|
|
return await _localAuth.authenticateWithBiometrics(
|
|
localizedReason: S.current.biometric_auth_reason,
|
|
useErrorDialogs: true,
|
|
stickyAuth: false);
|
|
} on PlatformException catch (e) {
|
|
print(e);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
Future<bool> canCheckBiometrics() async {
|
|
try {
|
|
return await _localAuth.canCheckBiometrics;
|
|
} on PlatformException catch (e) {
|
|
print(e);
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|