32 lines
956 B
Dart
32 lines
956 B
Dart
import 'dart:io';
|
|
|
|
import 'package:jailbreak_root_detection/jailbreak_root_detection.dart';
|
|
|
|
class SecurityService {
|
|
static Future<String?> get deviceCompromisedMessage async {
|
|
final isNotTrust = await JailbreakRootDetection.instance.isNotTrust;
|
|
if (isNotTrust) {
|
|
return 'Your device is rooted or jailbroken. For security reasons, you cannot access our services on a compromised device.';
|
|
}
|
|
|
|
final isRealDevice = await JailbreakRootDetection.instance.isRealDevice;
|
|
if (!isRealDevice) {
|
|
return 'Emulators are not allowed to access our services. Please use a real device.';
|
|
}
|
|
|
|
if (Platform.isAndroid) {
|
|
try {
|
|
final isOnExternalStorage =
|
|
await JailbreakRootDetection.instance.isOnExternalStorage;
|
|
if (isOnExternalStorage) {
|
|
return 'The application cannot be run from external storage.';
|
|
}
|
|
} catch (e) {
|
|
// Ignore
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|