Comments (10)
Hi,
Do want to backup a box or do you want to decrypt and use the data on the server?
Every encrypted entry also contains an IV without that, the entry cannot be decrypted.
What would putRaw()
and getRaw()
do exactly? And what would getRaw()
return for other objects?
from hive.
Hi,
I wanna backup the whole box, incrementally. Say I have 10 items total in the box now, after changing one item (box.put('myDog', dog)
), I sync it to the server right away. Or one item changed on the server, I need to sync the changed one to the client app.
I wanna encrypt the user data both on client app and server, and since Hive already encrypt data, I think reuse it is a good idea.
So what transferred between client app and server is NOT dog
, but the dog after encrypted. I'm not sure but I assume it's a String("xxxooo"
) stored on the storage after dog
encrypted.
Future<String> box.getRaw("myDog")
returns that String("xxxooo"
) and I sync this String("xxxooo"
) to the server.
Future<void> putRaw("myDog", "xxxooo from server")
save the change from the server directly.
Sorry that I'm not good at English.
from hive.
Okay I understand... The problem is that Hive stores objects as Uint8List
when running in the vm. In the browser, only non primitive and encrypted values are stored as Uint8List
. I don't know what getRaw()
should return. A string is impossible because of the IV.
I think the best way is to transfer the data unencrypted over HTTPS and handle encryption on the server (maybe even with another Hive ;).
You would have to sync the value, the IV and the encryption key otherwise.
Edit: You can implement your sync logic using watch()
from hive.
I got it. But encrypt and decrypt both on client and server will waste too much CPU :(
I can encrypt the data to a string by myself, and save this string in hive(box.put("myDog", "encrypted string")
). And I register a TypeAdapter say LongString
for it in case the encrypted string is too long.
Do you think it is a good idea?
from hive.
Sure you can do that but unless you change the data very often I would not worry about CPU usage. The AES algorithm Hive uses is quite fast.
from hive.
Thanks @leisim I'll double think how to design my app
from hive.
Won't transferring it unencrypted leave you vulnerable for mitm attacks?
from hive.
@ThinkDigitalSoftware this is why @leisim specified transferring over HTTPS to encrypt over the channels. The encryption here is so those who have direct access to the data can not read it (such as us developers) unless trusted.
from hive.
Oh that makes sense.
from hive.
@adriancmurray what approach did you end up taking? looking to rebuild my app and it definitely needs to be offline-first so im exploring options for persistence, including hive.
from hive.
Related Issues (20)
- Question: Read .hive files without using HiveDB functions
- Wrong Pub dev documentation
- Future of Hive/Isar HOT 2
- Github link missing in package listing on pub.dev
- Support for record types
- [Web] The "values" returned in "Box" are empty
- Fail to initialize Hive 4.0.0 for Flutter Web? HOT 1
- [Hive v4] Type mistmatch when get List<T> items.
- Unable to install on new flutter project HOT 1
- Support for enhanced enums
- Updating nested map keys
- Is the hive dead?
- Is there a way to use the map type adapter on a nested class using toJson?
- [Web] Issue with "Invalid argument(s): Invalid or corrupted pad block" in Flutter HOT 4
- Unhandled Exception: Out of Memory
- Flutter hive unit test HOT 1
- TypeId is not consistent and how to safely remove adapter
- iOS only: hive with encryption clearing database, app includes db usage in background HOT 2
- Wrong naming of hive constant global variable
- New data written to the disk is not immediately available. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hive.