signops 0.4.0
signops: ^0.4.0 copied to clipboard
SignOps in a Flutter app: Approve (push approval of sign-ins, keys in the Android Keystore and iOS Secure Enclave), passkeys and push open reporting.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:signops/signops.dart';
final signops = SignOps('pk_test_replace_me');
void main() => runApp(const MaterialApp(home: Home()));
class Home extends StatefulWidget {
const Home({super.key});
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
String status = '';
@override
void initState() {
super.initState();
signops.approve.status().then((s) => setState(() => status = s.enrolled ? 'Trusted for ${s.userId}' : 'Not enrolled')).catchError((Object e) => setState(() => status = '$e'));
}
@override
Widget build(BuildContext context) => Scaffold(
body: SafeArea(
child: Column(children: [
Text(status),
TextButton(
onPressed: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => Scaffold(body: ApproveScreen(signops: signops, onDone: (_) => Navigator.of(context).pop())))),
child: const Text('Check for approvals'),
),
]),
),
);
}