aegis_guardian 0.1.0
aegis_guardian: ^0.1.0 copied to clipboard
Native Android and iOS runtime security checks, device signing, screen privacy, and Apple App Attest for Flutter.
example/lib/main.dart
import 'package:aegis_guardian/aegis_guardian.dart';
import 'package:flutter/material.dart';
void main() => runApp(const GuardianExample());
class GuardianExample extends StatefulWidget {
const GuardianExample({super.key});
@override
State<GuardianExample> createState() => _GuardianExampleState();
}
class _GuardianExampleState extends State<GuardianExample> {
final guardian = AegisGuardian();
SecurityReport? report;
String? error;
bool busy = false;
bool protected = false;
Future<void> scan() async {
setState(() {
busy = true;
error = null;
});
try {
final value = await guardian.scan();
if (mounted) {
setState(() {
report = value;
});
}
} catch (e) {
if (mounted) {
setState(() {
error = e.toString();
});
}
} finally {
if (mounted) {
setState(() {
busy = false;
});
}
}
}
@override
Widget build(BuildContext context) => MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('AegisGuardian')),
body: ListView(
padding: const EdgeInsets.all(16),
children: [
const Text(
'Native security signals for this device. Verification decisions belong on your server.',
),
FilledButton(
onPressed: busy ? null : scan,
child: Text(busy ? 'Scanning…' : 'Scan device'),
),
SwitchListTile(
title: const Text('Screen privacy'),
subtitle: const Text(
'iOS hides inactive/captured content; screenshots are not blocked.',
),
value: protected,
onChanged: (value) async {
try {
await guardian.setScreenProtection(value);
if (mounted) {
setState(() {
protected = value;
error = null;
});
}
} catch (e) {
if (mounted) {
setState(() {
error = e.toString();
});
}
}
},
),
if (error != null) SelectableText(error!),
if (report != null) ...[
Text('Platform: ${report!.platform}'),
for (final check in report!.checks)
ListTile(
title: Text(check.check.name),
subtitle: Text(check.status.name),
trailing: Icon(
check.status == CheckStatus.clear
? Icons.check
: Icons.info_outline,
),
),
],
],
),
),
);
}