isar / hive

Lightweight and blazing fast key-value database written in pure Dart.
Apache License 2.0
3.95k stars 392 forks source link

Crash while using encryption on iOS #1075

Open robman70 opened 1 year ago

robman70 commented 1 year ago

Problem I have been using Hive with satisfaction for some months in apps developed with Flutter for Android without any particular problems but today I started the development of a new app for iOS and I encountered a problem: if I enable the encryption, the app crashes because it fails to open the box. Is it enough to disable the encryption for everything to work correctly? Has anyone had similar problems?

Code sample

box = await Hive.openBox(boxName, encryptionCipher: HiveAesCipher(encryptionKey));

Version

robman70 commented 1 year ago

This problem is still here. :-( Can anyone help me?

MrMineToons commented 9 months ago

Hello! I also had this problem. I fixed it following this issue https://github.com/mogol/flutter_secure_storage/issues/210 There is 3 ways that I found to fix the crash on start. I applied all of them, now everything is working as expected.

The problem is with flutter_secure_storage, and not with hive... Its very difficult to debug because, with me, I couldn't reproduce in debug or with my phone. It looks like to only happens in release build, and with some specific phones..

The code that crash the app is this line -> final encryptionKeyString = await secureStorage.read(key: 'key');