Secure storage overwrite fix (#1161)

* secure storage overwrite fix

* add comment

* bump encrypt package, use more explicit iv source

---------

Co-authored-by: fossephate <fosse@book.local>
This commit is contained in:
Matthew Fosse
2023-11-15 19:31:25 +02:00
committed by GitHub
co-authored by fossephate
parent fdeee8874a
commit 062315f01b
3 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -38,6 +38,9 @@ class AuthService with Store {
Future<void> setPassword(String password) async {
final key = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
final encodedPassword = encodedPinCode(pin: password);
// secure storage has a weird bug on macOS, where overwriting a key doesn't work, unless
// we delete what's there first:
await secureStorage.delete(key: key);
await secureStorage.write(key: key, value: encodedPassword);
}
@@ -104,9 +107,8 @@ class AuthService with Store {
}
return;
}
}
}
Navigator.of(context).pushNamed(Routes.auth,
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
if (!isAuthenticatedSuccessfully) {
@@ -140,8 +142,6 @@ class AuthService with Store {
}
}
}
});
});
}
}