33 lines
1.0 KiB
Dart
33 lines
1.0 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:service/print.dart';
|
|
|
|
class SecurityHelper {
|
|
static const platform = MethodChannel('com.service_intaleq/security');
|
|
|
|
static Future<String?> getAppSignature() async {
|
|
try {
|
|
final String? signature = await platform.invokeMethod('getAppSignature');
|
|
final mode = kDebugMode ? 'DEBUG' : 'RELEASE';
|
|
Log.print('----------------------------------------------------');
|
|
Log.print('🚀 APP SIGNATURE HASH ($mode): $signature');
|
|
Log.print('----------------------------------------------------');
|
|
return signature;
|
|
|
|
} on PlatformException catch (e) {
|
|
Log.print('❌ Failed to get app signature: ${e.message}');
|
|
return null;
|
|
}
|
|
}
|
|
|
|
static Future<bool> isDeviceRooted() async {
|
|
try {
|
|
final bool isRooted = await platform.invokeMethod('isNativeRooted');
|
|
return isRooted;
|
|
} on PlatformException catch (e) {
|
|
Log.print('❌ Failed to check root: ${e.message}');
|
|
return false;
|
|
}
|
|
}
|
|
}
|