isar / isar/hive

Using hive for web: "Invalid argument(s): Invalid or corrupted pad block" on refresh browser

Open
#652 3 comments 7 reactions 0 assignees View on GitHub
problem
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

**Steps to Reproduce**
Here is a repository to reproduce the issue:
https://github.com/BenPoell/hive_reproduce

Following setting:
- using named routes for navigation
- storing the **encrypted hive box** in a Flavor
- init the hive box in main
- navigate from the start screen to another route
- set the value in the box on the second route
- (navigate back and forth)
- refresh the browser

On reload the error `Invalid argument(s): Invalid or corrupted pad block"` occurs

**Stack trace**
```
Error: Invalid argument(s): Invalid or corrupted pad block
at Object.throw_ [as throw] (http://localhost:61171/dart_sdk.js:5333:11)
at aes_cbc_pkcs7.AesCbcPkcs7.new.decrypt (http://localhost:61171/packages/hive/src/crypto/aes_cbc_pkcs7.dart.lib.js:133:21)
at hive.HiveAesCipher.new.decrypt (http://localhost:61171/packages/hive/src/box/lazy_box_impl.dart.lib.js:3829:28)
at binary_reader_impl.BinaryReaderImpl.new.readEncrypted (http://localhost:61171/packages/hive/src/box/lazy_box_impl.dart.lib.js:1684:30)
at storage_backend_js.StorageBackendJs.new.decodeValue (http://localhost:61171/packages/hive/src/box/lazy_box_impl.dart.lib.js:1809:27)
at MappedListIterable.new.elementAt (http://localhost:61171/dart_sdk.js:22725:25)
at ListIterator.new.moveNext (http://localhost:61171/dart_sdk.js:22520:55)
at JsIterator.next (http://localhost:61171/dart_sdk.js:7057:21)
at storage_backend_js.StorageBackendJs.new.initialize (http://localhost:61171/packages/hive/src/box/lazy_box_impl.dart.lib.js:1881:20)
at initialize.next ()
at http://localhost:61171/dart_sdk.js:39031:33
at _RootZone.runUnary (http://localhost:61171/dart_sdk.js:38888:58)
at _FutureListener.thenAwait.handleValue (http://localhost:61171/dart_sdk.js:33874:29)
at handleValueCallback (http://localhost:61171/dart_sdk.js:34434:49)
at Function._propagateToListeners (http://localhost:61171/dart_sdk.js:34472:17)
at _Future.new.[_completeWithValue] (http://localhost:61171/dart_sdk.js:34314:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:61171/dart_sdk.js:34337:35)
at Object._microtaskLoop (http://localhost:61171/dart_sdk.js:39175:13)
at _startMicrotaskLoop (http://localhost:61171/dart_sdk.js:39181:13)
at http://localhost:61171/dart_sdk.js:34688:9
```

**Version**
- Platform: Web
- Flutter version: 2.0.4
- Hive version: 2.0.4

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.