hasBundleBeenCompromised method Null safety

Future<bool?> hasBundleBeenCompromised(
  1. {required IosSecurityOptions? iosSecurityOptions}
)

hasBundleBeenCompromised returns true if MD5 contained in the encryptd source file doesn't match with the one calculated at runtime

iOs only

First you need to use the script you can find here to generate an encrypted Map<String, String> like in JsonObject, then use jsonFileName to pass the file name

Implementation

static Future<bool?> hasBundleBeenCompromised({
  required IosSecurityOptions? iosSecurityOptions,
}) async {
  late Map<String, dynamic> arguments;

  if (Platform.isIOS) {
    try {
      if (iosSecurityOptions?.bundleId == null ||
          iosSecurityOptions?.jsonFileName == null ||
          iosSecurityOptions?.cryptographicKey == null)
        throw ResponseSecurityCodes.missingParametersError;

      arguments = iosSecurityOptions!.toJson();

      final decryptedObject = await _getDecriptedObject(
          arguments: arguments, iosSecurityOptions: iosSecurityOptions);

      if (decryptedObject == null) return null;
      final nativeJsonObject = await _getNativeJsonObject(
          decriptedObject: decryptedObject,
          iosSecurityOptions: iosSecurityOptions);

      return await _areMD5different(
        decryptedObject: decryptedObject,
        nativeJsonObject: nativeJsonObject,
      );
    } on PlatformException catch (e) {
      throw PlatformResponseCodes.fromString(e.code);
    }
  }
  throw ResponseSecurityCodes.unavailable;
}