quixxi_app_attestation 0.0.1-beta.4
quixxi_app_attestation: ^0.0.1-beta.4 copied to clipboard
A Flutter plugin that provides real-time application integrity verification using the Quixxi App Attestation service.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:quixxi_app_attestation/quixxi_app_attestation.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _statusMessage = 'Tap the button to start attestation';
bool _isLoading = false;
final TextEditingController _emailController = TextEditingController();
final TextEditingController _passwordController = TextEditingController();
Future<void> initAppAttestation() async {
setState(() {
_isLoading = true;
_statusMessage = 'Starting attestation...';
});
try {
final result = await QuixxiAppAttestation.init(
privateKey: '<YOUR_PRIVATE_KEY>',
baseUrl: '<YOUR_BASE_URL>',
appGuid: '<YOUR_APP_GUID>',
);
setState(() {
_statusMessage = result
? 'Success: Attestation verified'
: 'Failure: Attestation failed';
_isLoading = false;
});
} catch (e) {
setState(() {
_statusMessage = 'Error: ${e.toString()}';
_isLoading = false;
});
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
backgroundColor: const Color(0xFF2E2E2E),
appBar: AppBar(
backgroundColor: const Color(0xFF1E1E1E),
elevation: 0,
title: const Text('SDK'),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 40),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
'assets/images/quixxi_icon.png',
width: 140,
height: 140,
),
const SizedBox(height: 50),
const Align(
alignment: Alignment.centerLeft,
child: Text(
"Email",
style: TextStyle(color: Colors.tealAccent, fontSize: 14),
),
),
TextField(
controller: _emailController,
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.teal),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.tealAccent),
),
),
),
const SizedBox(height: 30),
const Align(
alignment: Alignment.centerLeft,
child: Text(
"Password",
style: TextStyle(color: Colors.tealAccent, fontSize: 14),
),
),
TextField(
controller: _passwordController,
obscureText: true,
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.teal),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.tealAccent),
),
),
),
const SizedBox(height: 50),
SizedBox(
width: double.infinity,
height: 55,
child: ElevatedButton(
onPressed: _isLoading ? null : initAppAttestation,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF038C8C),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
child: _isLoading
? const CircularProgressIndicator(color: Colors.white)
: const Text(
'LOGIN',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.white),
),
),
),
const SizedBox(height: 30),
if (_statusMessage.isNotEmpty)
Text(
_statusMessage,
textAlign: TextAlign.center,
style: const TextStyle(color: Colors.white, fontSize: 14),
),
],
),
),
),
),
);
}
}