DefinedNet / mobile_nebula

Brings nebula to mobile devices (iOS, Android)
https://defined.net
123 stars 37 forks source link

Fix encryption errors after restoring to a new phone #143

Closed johnmaguire closed 8 months ago

johnmaguire commented 9 months ago

Fixes #117

Solution comes from here:

Both users are using EncryptedSharedPreferences which stores the encryption key alongside the preference value.

We use EncryptedFile which stores the encryption key in a SharedPreferences, for use by all files:

    private static final String KEYSET_PREF_NAME =
            "__androidx_security_crypto_encrypted_file_pref__";

Therefore, we must also delete this SharedPreference in order to completely clear the old key.

An alternative solution is to disallow backups/restores. I think that with the current solution, any restored site will be deleted immediately anyway.