chore: Improved error handling for recovery key

This commit is contained in:
Krille 2024-02-01 07:56:39 +01:00
commit 2af8691536
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
2 changed files with 17 additions and 9 deletions

View file

@ -266,6 +266,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
),
hintText: L10n.of(context)!.recoveryKey,
errorText: _recoveryKeyInputError,
errorMaxLines: 2,
),
),
const SizedBox(height: 16),
@ -290,6 +291,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
final key = _recoveryKeyTextEditingController
.text
.trim();
if (key.isEmpty) return;
await bootstrap.newSsssKey!.unlock(
keyOrPassphrase: key,
);
@ -317,6 +319,11 @@ class BootstrapDialogState extends State<BootstrapDialog> {
() => _recoveryKeyInputError =
e.toLocalizedString(context),
);
} on FormatException catch (_) {
setState(
() => _recoveryKeyInputError =
L10n.of(context)!.wrongRecoveryKey,
);
} catch (e, s) {
ErrorReporter(
context,