patrickfav / armadillo

A shared preference implementation for confidential data in Android. Per default uses AES-GCM, BCrypt and HKDF as cryptographic primitives. Uses the concept of device fingerprinting combined with optional user provided passwords and strong password hashes.
https://favr.dev/opensource/armadillo
Apache License 2.0
280 stars 52 forks source link

Jetpack DataStore Integrations. #54

Open marukami opened 4 years ago

marukami commented 4 years ago

This is an initial attempt to integrate with Jetpack DataStore

This is very much a first draft. As I'm still trying to work out how and what is needed to have min changeset to have both SharedPreferences and DataStore

Would moving the shared logic into a Core module make it easier to support either or both SharedPreferences and DataStore?

Feedback is very much welcome.

NOTE Kotlin is required as DataStore takes a hard dependency on Kotlin coroutines.

Follows #53

marukami commented 3 years ago

Update: Had a bit more time to work on this. There are a few things that I think would be needed here.

Since DataStore keeps everything in a single protobuf encoded byte array if the store changes… yer, it all falls apart. Encryption fails as the protobuff encode/decode will fail to work now after say adding a new field. So, my thinking is to try wrapping the user protobuf with a decorator proto to track meta-data. One issue with that idea is that this might need to take a hard dependency on a specific protobuf implementation.

@patrickfav To make DataStore work as a separate module some package-private classes need to be made public, so, would it make sense to pull all the common code into a Core module?