fix: Linux failing on attempting to open hive

This commit is contained in:
Sorunome 2021-07-20 17:56:13 +02:00
parent 9a74d0977b
commit 76e476e2f9
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C

View File

@ -49,9 +49,12 @@ class FlutterFamedlySdkHiveDatabase extends FamedlySdkHiveDatabase {
);
}
final encryptionKey = base64Url.decode(
await secureStorage.read(key: _hiveCipherStorageKey),
);
// workaround for if we just wrote to the key and it still doesn't exist
final rawEncryptionKey =
await secureStorage.read(key: _hiveCipherStorageKey);
if (rawEncryptionKey == null) throw MissingPluginException();
final encryptionKey = base64Url.decode(rawEncryptionKey);
hiverCipher = HiveAesCipher(encryptionKey);
} on MissingPluginException catch (_) {
Logs().i('Hive encryption is not supported on this platform');