added root and frida detection
This commit is contained in:
31
lib/security/security_service.dart
Normal file
31
lib/security/security_service.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user