guardianproject / haven

Haven is for people who need a way to protect their personal spaces and possessions without compromising their own privacy, through an Android app and on-device sensors
https://guardianproject.github.io/haven/
GNU General Public License v3.0
6.63k stars 728 forks source link

Migrate from Sugar ORM to Room Persistence? #129

Closed fat-tire closed 5 years ago

fat-tire commented 6 years ago

This is just a thought, but the Sugar ORM library seems to be pretty old, as in it hasn't been updated for 8 months, still targets sdk 23, and I'm not sure if it's being updated?

The new Android Room Persistence Library does basically the same thing but perhaps it will be better maintained over time as it's a Google standard library? So maybe move the Event and EventTrigger classes over? (Does anything else use SugarRecord?)

n8fr8 commented 6 years ago

Makes sense to me. I like Sugar, but agreed, it doesn't seem up to date.

On thing we have been considering though, is migrating to SQLCipher and IOCipher for encrypted data and media storage. With Sugar, we can fork it, and put SQLCipher underneath. With the Android Room API, we cannot do that.

opticod commented 6 years ago

Currently the Sugar is not supported by Instant Run feature of Android Studio 2.2+, so we are facing some SQLExceptions as mentioned in #63

fat-tire commented 6 years ago

@n8fr8 -- Is the system full-disk encryption not sufficient for Haven's purposes?

froriz5 commented 6 years ago

@n8fr8 Room supports other Sqlite implementations such as SQLCipher. It involves something like:

// EditText passphraseField;
SafeHelperFactory factory=SafeHelperFactory.fromUser(passphraseField.getText());

StuffDatabase db=Room.databaseBuilder(ctxt, StuffDatabase.class, DB_NAME)
  .openHelperFactory(factory)
  .build();

This example uses the SafeRoom database implementation, but I imagine using SQLCipher would be similar. More info on that here: https://commonsware.com/AndroidArch/previews/securing-your-room

archie94 commented 5 years ago

On thing we have been considering though, is migrating to SQLCipher and IOCipher for encrypted data and media storage. With Sugar, we can fork it, and put SQLCipher underneath. With the Android Room API, we cannot do that.

@n8fr8 is database encryption still a thing we should aim for? This was not done in #307 . Let me know what you think.