fix: Don't allow an empty ssss passphrase in key verification

This commit is contained in:
Sorunome 2020-12-31 11:36:01 +01:00
parent a2b8f9eaa1
commit 3a0ce799ba
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
1 changed files with 3 additions and 8 deletions

View File

@ -67,7 +67,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
final textEditingController = TextEditingController();
String input;
final checkInput = () async {
if (input == null) {
if (input == null || input.isEmpty) {
return;
}
final valid = await showFutureLoadingDialog(
@ -77,15 +77,10 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
await Future.delayed(Duration(milliseconds: 100));
var valid = false;
try {
await widget.request.openSSSS(recoveryKey: input);
await widget.request.openSSSS(keyOrPassphrase: input);
valid = true;
} catch (_) {
try {
await widget.request.openSSSS(passphrase: input);
valid = true;
} catch (_) {
valid = false;
}
valid = false;
}
return valid;
});