mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-08 08:07:56 -06:00
29 lines
781 B
Dart
29 lines
781 B
Dart
import 'package:injectable/injectable.dart';
|
|
import 'package:local_auth/local_auth.dart';
|
|
import 'package:paperless_mobile/core/store/local_vault.dart';
|
|
|
|
@lazySingleton
|
|
class LocalAuthenticationService {
|
|
final LocalVault localStore;
|
|
final LocalAuthentication localAuthentication;
|
|
|
|
LocalAuthenticationService(
|
|
this.localStore,
|
|
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;
|
|
}
|
|
}
|