checkForSecurityIssues method

Future<void> checkForSecurityIssues()

Runs all enabled security checks.

Boolean checks (isNotTrust, isJailBroken, etc.) throw a SingleJailbreakException immediately on the first failure.

The checkForIssues check throws a MultiJailbreakException with a list of all detected JailbreakIssues for the UI to render as bullet points.

Implementation

Future<void> checkForSecurityIssues() async {
  // --- Phase 1: Boolean checks — fail fast on first detected issue ---
  await _performCheck(SecurityCheckType.isNotTrust, () => _detector.isNotTrust);
  await _performCheck(SecurityCheckType.isJailBroken, () => _detector.isJailBroken);
  await _performCheck(SecurityCheckType.isRealDevice, () async => !(await _detector.isRealDevice));

  if (Platform.isAndroid) {
    await _performCheck(SecurityCheckType.isOnExternalStorage, () => _detector.isOnExternalStorage);
    await _performCheck(SecurityCheckType.isDevMode, () => _detector.isDevMode);
  }

  // --- Phase 2: Multi-issue check — produces a detailed issue list ---
  await _performCheckForIssues();

  // --- Phase 3: iOS-only tampered check ---
  if (Platform.isIOS) {
    await _performTamperedCheck();
  }
}