cross_device_integrity 1.0.5
cross_device_integrity: ^1.0.5 copied to clipboard
Unified cross-platform device integrity and security detection for Flutter (Root, Jailbreak, Emulator, Frida, Magisk, Developer Mode, Mock Location, VPN, Proxy, Screen Recording).
Device Integrity (device_integrity) #
A production-ready, unified cross-platform security & device integrity Flutter package built for banking, fintech, and high-security enterprise applications.
Combines 10 essential security checks into a single, cohesive API across Android, iOS, macOS, Windows, Linux, and Web.
🛡️ Supported Detection Signals #
| Check | Android | iOS | macOS | Windows | Linux | Web | Description |
|---|---|---|---|---|---|---|---|
| Root Detection | ✅ | — | — | — | ✅ | — | SU binaries, test-keys, RW mount, superuser apps |
| Jailbreak Detection | — | ✅ | — | — | — | — | Cydia/Sileo, sandbox write test, DYLD hooks, fork test |
| Emulator Detection | ✅ | ✅ | — | ✅ | ✅ | ✅ | QEMU, Genymotion, BlueStacks, CPUID, Web Automation |
| Developer Mode | ✅ | — | ✅ | ✅ | — | — | ADB debugging, USB developer settings |
| Mock Location | ✅ | ✅ | — | — | — | — | Location.isMock, fake GPS providers |
| VPN Detection | ✅ | ✅ | ✅ | ✅ | ✅ | — | TUN/TAP/PPP interfaces, ConnectivityManager |
| Proxy Detection | ✅ | ✅ | ✅ | ✅ | ✅ | — | HTTP/HTTPS system proxy configurations |
| Frida Detection | ✅ | ✅ | — | — | — | — | Dynamic instrumentation, D-Bus port 27042, maps scan |
| Magisk Detection | ✅ | — | — | — | — | — | Systemless root, Magisk paths, overlay mounts |
| Screen Recording | ✅ | ✅ | ✅ | — | — | ✅ | Active screen capture, mirroring, recording |
Note: Checks marked — gracefully return IntegrityStatus.unsupported on that platform without throwing exceptions.
🚀 Quick Start #
1. Add Dependency #
Add device_integrity to your pubspec.yaml:
dependencies:
device_integrity: ^1.0.0
2. Run All Checks #
import 'package:device_integrity/device_integrity.dart';
Future<void> evaluateDeviceSecurity() async {
final result = await DeviceIntegrityChecker.checkAll();
if (result.isFullySecure) {
print("✅ Environment is secure.");
} else {
print("⚠️ Security threats detected: ${result.threats}");
// Example output: ["Root Access", "Active VPN", "Screen Recording"]
}
}
3. Individual Checks #
final rootStatus = await DeviceIntegrityChecker.checkRoot();
if (rootStatus == IntegrityStatus.compromised) {
// Handle root compromise
}
final vpnStatus = await DeviceIntegrityChecker.checkVPN();
final screenRecStatus = await DeviceIntegrityChecker.checkScreenRecording();
4. Continuous Real-Time Monitoring #
final subscription = DeviceIntegrityChecker.monitorIntegrity(
interval: const Duration(seconds: 10),
).listen((result) {
if (result.hasAnyThreat) {
// Flag risk to backend or obscure sensitive UI
}
});
📊 Status Enum Reference #
Each check returns an IntegrityStatus:
IntegrityStatus.secure: Check passed — environment is clean.IntegrityStatus.compromised: Security threat detected.IntegrityStatus.unsupported: Check not applicable on current OS.IntegrityStatus.error: Error executing check.
🔒 Recommended Best Practices for Fintech & Banking Apps #
- Layered Defense: Client-side checks provide immediate detection against casual threats. For high-risk transactions, combine client signals with Google Play Integrity API or Apple App Attest server-side token validation.
- Server Enforcement: Send
result.toJson()to your API server and evaluate overall risk on the backend rather than crashing locally. - Obfuscation: Enable Dart obfuscation during production builds (
flutter build apk --obfuscate --split-debug-info=...).