monorepo/dialer/lib/features/settings/key/manage_keys_page.dart
Bartosz e8aba933d0
All checks were successful
/ mirror (push) Successful in 4s
Cryptographic Keys and History changes (#8)
Co-authored-by: stcb <21@stcb.cc>
Reviewed-on: icing/G-EIP-700-TLS-7-1-eip-stephane.corbiere#8
Co-authored-by: Bartosz <bartosz.michalak@epitech.eu>
Co-committed-by: Bartosz <bartosz.michalak@epitech.eu>
2024-12-20 09:13:05 +00:00

81 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import 'show_public_key_qr.dart';
import 'show_public_key_text.dart';
import 'generate_new_key_pair.dart';
import 'export_private_key.dart';
import 'delete_key_pair.dart';
class KeyManagementPage extends StatelessWidget {
const KeyManagementPage({super.key});
void _navigateToOption(BuildContext context, String option) {
switch (option) {
case 'Display public key as text':
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const DisplayPublicKeyTextPage()),
);
break;
case 'Display public key as QR code':
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const DisplayPublicKeyQRCodePage()),
);
break;
case 'Generate a new key pair':
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const GenerateNewKeyPairPage()),
);
break;
case 'Export private key to password-encrypted file (AES 256)':
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const ExportPrivateKeyPage()),
);
break;
case 'Delete a key pair':
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const DeleteKeyPairPage()),
);
break;
default:
break;
}
}
@override
Widget build(BuildContext context) {
final keyManagementOptions = [
'Display public key as text',
'Display public key as QR code',
'Generate a new key pair',
'Export private key to password-encrypted file (AES 256)',
'Delete a key pair',
];
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
title: const Text('Key Management'),
),
body: ListView.builder(
itemCount: keyManagementOptions.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(
keyManagementOptions[index],
style: const TextStyle(color: Colors.white),
),
trailing: const Icon(Icons.arrow_forward_ios, color: Colors.white),
onTap: () {
_navigateToOption(context, keyManagementOptions[index]);
},
);
},
),
);
}
}