Await for async functions
This commit is contained in:
parent
a4323ad280
commit
429b71de4a
2 changed files with 5 additions and 5 deletions
|
@ -63,7 +63,6 @@ class Configuration {
|
|||
keyDecryptionNonce: encryptedKeyData.nonce.base64,
|
||||
);
|
||||
await setKey(Sodium.bin2base64(key));
|
||||
await setEncryptedKey(encryptedKeyData.encryptedData.base64);
|
||||
await setKeyAttributes(attributes);
|
||||
return attributes;
|
||||
}
|
||||
|
@ -147,6 +146,7 @@ class Configuration {
|
|||
Future<void> setKeyAttributes(KeyAttributes attributes) async {
|
||||
await _preferences.setString(
|
||||
keyAttributesKey, attributes == null ? null : attributes.toJson());
|
||||
await setEncryptedKey(attributes == null ? null : attributes.encryptedKey);
|
||||
}
|
||||
|
||||
KeyAttributes getKeyAttributes() {
|
||||
|
|
|
@ -102,8 +102,8 @@ class UserAuthenticator {
|
|||
)
|
||||
.catchError((e) async {
|
||||
await dialog.hide();
|
||||
Configuration.instance.setKey(null);
|
||||
Configuration.instance.setKeyAttributes(null);
|
||||
await Configuration.instance.setKey(null);
|
||||
await Configuration.instance.setKeyAttributes(null);
|
||||
_logger.severe(e);
|
||||
showGenericErrorDialog(context);
|
||||
}).then((response) async {
|
||||
|
@ -112,8 +112,8 @@ class UserAuthenticator {
|
|||
Bus.instance.fire(UserAuthenticatedEvent());
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
} else {
|
||||
Configuration.instance.setKey(null);
|
||||
Configuration.instance.setKeyAttributes(null);
|
||||
await Configuration.instance.setKey(null);
|
||||
await Configuration.instance.setKeyAttributes(null);
|
||||
showGenericErrorDialog(context);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue