fix: secure storage on iOS was not setting up correctly
This commit is contained in:
parent
eb1c3e1c43
commit
2ef03b09dd
4 changed files with 7 additions and 4 deletions
|
|
@ -40,7 +40,7 @@ class FlutterFluffyBoxDatabase extends FluffyBoxDatabase {
|
|||
|
||||
const secureStorage = FlutterSecureStorage();
|
||||
final containsEncryptionKey =
|
||||
await secureStorage.containsKey(key: _cipherStorageKey);
|
||||
await secureStorage.read(key: _cipherStorageKey) != null;
|
||||
if (!containsEncryptionKey) {
|
||||
// do not try to create a buggy secure storage for new Linux users
|
||||
if (Platform.isLinux) throw MissingPluginException();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
|
|||
|
||||
const secureStorage = FlutterSecureStorage();
|
||||
final containsEncryptionKey =
|
||||
await secureStorage.containsKey(key: _cipherStorageKey);
|
||||
await secureStorage.read(key: _cipherStorageKey) != null;
|
||||
if (!containsEncryptionKey) {
|
||||
// do not try to create a buggy secure storage for new Linux users
|
||||
if (Platform.isLinux) throw MissingPluginException();
|
||||
|
|
@ -50,6 +50,9 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
|
|||
|
||||
hiverCipher = HiveAesCipher(base64Url.decode(rawEncryptionKey));
|
||||
} on MissingPluginException catch (_) {
|
||||
const FlutterSecureStorage()
|
||||
.delete(key: _cipherStorageKey)
|
||||
.catchError((_) {});
|
||||
Logs().i('Hive encryption is not supported on this platform');
|
||||
} catch (e, s) {
|
||||
const FlutterSecureStorage()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue