fix: read back sent copies after the sec 5.6 upstream fix, pinned at 2d65d66
This commit is contained in:
parent
52947e153d
commit
d6f4c434fa
36 changed files with 4223 additions and 3118 deletions
|
|
@ -12,9 +12,8 @@ import "package:smol_mail/data/providers/providers.dart";
|
|||
import "package:smol_mail/presentation/routes/app_router.gr.dart";
|
||||
import "package:smol_mail/presentation/theme/app_colors.dart";
|
||||
import "package:smol_mail/shared/utils/snackbar.dart";
|
||||
import "package:smol_mail/smol/crypto.dart";
|
||||
import "package:smol_mail/smol/errors.dart";
|
||||
import "package:smol_mail/smol/proto.dart";
|
||||
import "package:smol_mail/smol/ui.dart";
|
||||
|
||||
/// Identity card, server pins, rotation and the wipe. The seed is the only
|
||||
/// secret; revealing it is always an explicit action.
|
||||
|
|
@ -69,10 +68,11 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|||
// pinned servers into one shareable file; never the seed.
|
||||
Future<void> _export() async {
|
||||
final store = ref.read(storeProvider);
|
||||
final data = store.exportData();
|
||||
// exportData is the sealed gsmol container itself; the file body is its
|
||||
// JSON, already sealed to the master-derived key.
|
||||
final bytes = Uint8List.fromList(utf8.encode(await store.exportData()));
|
||||
final stamp = DateTime.now().toIso8601String().substring(0, 10);
|
||||
final fileName = "kirakira-backup-$stamp.json";
|
||||
final bytes = Uint8List.fromList(utf8.encode(jsonEncode(data)));
|
||||
try {
|
||||
// share_plus has no file-sharing implementation on desktop platforms —
|
||||
// it throws UnimplementedError for Linux/Windows/macOS — so those save
|
||||
|
|
@ -108,8 +108,8 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|||
final path = files.isEmpty ? null : files.single.path;
|
||||
if (path == null) return;
|
||||
try {
|
||||
final data = jsonDecode(File(path).readAsStringSync()) as Map;
|
||||
final summary = await ref.read(storeProvider).importData(data);
|
||||
final summary =
|
||||
await ref.read(storeProvider).importData(File(path).readAsStringSync());
|
||||
ref.read(revisionProvider.notifier).bump();
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
|
|
@ -165,7 +165,7 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|||
ref.read(revisionProvider.notifier).bump();
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text("rotated; new key ${b32encode(fresh.publicKey)}")),
|
||||
SnackBar(content: Text("rotated; new key ${fresh.publicKey}")),
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
@ -313,7 +313,7 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(host),
|
||||
subtitle: Text(
|
||||
b32encode(key),
|
||||
key,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue