Files
paperless-mobile/lib/features/login/services/authentication_service.dart
2023-01-23 02:24:01 +01:00

24 lines
606 B
Dart

import 'package:local_auth/local_auth.dart';
class LocalAuthenticationService {
final LocalAuthentication localAuthentication;
LocalAuthenticationService(
this.localAuthentication,
);
Future<bool> authenticateLocalUser(String localizedReason) async {
if (await localAuthentication.isDeviceSupported()) {
return await localAuthentication.authenticate(
localizedReason: localizedReason,
options: const AuthenticationOptions(
stickyAuth: true,
biometricOnly: true,
useErrorDialogs: true,
),
);
}
return false;
}
}