<!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Description This is a PR that makes the auth build runnable on the Desktop platform. Below is a screenshot for the same:  Some things to note: - LocalAuth will be bypassed on unsupported platforms (desktop) - Switched to sodium and sodium-libs from flutter_sodium. - QR code library is incompatible with desktop, So I removed access to those pages. - Bumped some dependencies and done some lint fixes - Also add save key option as send file may not help on desktop (related #380) https://github.com/ente-io/auth/assets/41370460/3f3471e8-45f6-4146-88ac-b763d4f38b32 - Update Recovery Key Card UI  So this is a step towards more updated code and better multiplatform support. ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [ ] 🖼️ New icon - [x] ✨ New feature (non-breaking change which adds functionality) - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) - [x] 🧹 Code refactor - [ ] ✅ Build configuration change - [ ] 📝 Documentation - [ ] 🗑️ Chore --------- Co-authored-by: Neeraj Gupta <254676+ua741@users.noreply.github.com>
95 lines
2.9 KiB
Dart
95 lines
2.9 KiB
Dart
import 'package:ente_auth/core/configuration.dart';
|
|
import 'package:ente_auth/l10n/l10n.dart';
|
|
import 'package:ente_auth/ui/settings/common_settings.dart';
|
|
import 'package:ente_auth/ui/settings/settings_section_title.dart';
|
|
import 'package:ente_auth/ui/settings/settings_text_item.dart';
|
|
import 'package:ente_crypto_dart/ente_crypto_dart.dart';
|
|
import 'package:expandable/expandable.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class DebugSectionWidget extends StatelessWidget {
|
|
const DebugSectionWidget({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// This is a debug only section not shown to end users, so these strings are
|
|
// not translated.
|
|
return ExpandablePanel(
|
|
header: const SettingsSectionTitle("Debug"),
|
|
collapsed: Container(),
|
|
expanded: _getSectionOptions(context),
|
|
theme: getExpandableTheme(),
|
|
);
|
|
}
|
|
|
|
Widget _getSectionOptions(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
GestureDetector(
|
|
behavior: HitTestBehavior.translucent,
|
|
onTap: () async {
|
|
_showKeyAttributesDialog(context);
|
|
},
|
|
child: const SettingsTextItem(
|
|
text: "Key attributes",
|
|
icon: Icons.navigate_next,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
void _showKeyAttributesDialog(BuildContext context) {
|
|
final l10n = context.l10n;
|
|
final keyAttributes = Configuration.instance.getKeyAttributes()!;
|
|
final AlertDialog alert = AlertDialog(
|
|
title: const Text("key attributes"),
|
|
content: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
const Text(
|
|
"Key",
|
|
style: TextStyle(fontWeight: FontWeight.bold),
|
|
),
|
|
Text(CryptoUtil.bin2base64(Configuration.instance.getKey()!)),
|
|
const Padding(padding: EdgeInsets.all(12)),
|
|
const Text(
|
|
"Encrypted Key",
|
|
style: TextStyle(fontWeight: FontWeight.bold),
|
|
),
|
|
Text(keyAttributes.encryptedKey),
|
|
const Padding(padding: EdgeInsets.all(12)),
|
|
const Text(
|
|
"Key Decryption Nonce",
|
|
style: TextStyle(fontWeight: FontWeight.bold),
|
|
),
|
|
Text(keyAttributes.keyDecryptionNonce),
|
|
const Padding(padding: EdgeInsets.all(12)),
|
|
const Text(
|
|
"KEK Salt",
|
|
style: TextStyle(fontWeight: FontWeight.bold),
|
|
),
|
|
Text(keyAttributes.kekSalt),
|
|
const Padding(padding: EdgeInsets.all(12)),
|
|
],
|
|
),
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
child: Text(l10n.ok),
|
|
onPressed: () {
|
|
Navigator.of(context, rootNavigator: true).pop('dialog');
|
|
},
|
|
),
|
|
],
|
|
);
|
|
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return alert;
|
|
},
|
|
);
|
|
}
|
|
}
|