1
0
Fork 0

For #8324 - Only use encrypted storage for Nightly/Debug populations

master
ekager 2020-02-15 12:59:18 -08:00 committed by Jeff Boek
parent c1f0e7bb33
commit f52f87f6a4
1 changed files with 9 additions and 2 deletions

View File

@ -43,6 +43,7 @@ import mozilla.components.lib.dataprotect.generateEncryptionKey
import mozilla.components.service.sync.logins.AsyncLoginsStorageAdapter
import mozilla.components.service.sync.logins.SyncableLoginsStore
import org.mozilla.fenix.AppRequestInterceptor
import org.mozilla.fenix.Config
import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
@ -219,9 +220,15 @@ class Core(private val context: Context) {
/**
* Shared Preferences that encrypt/decrypt using Android KeyStore and lib-dataprotect for 23+
* otherwise simply stored
* only on Nightly/Debug for now, otherwise simply stored.
* See https://github.com/mozilla-mobile/fenix/issues/8324
*/
fun getSecureAbove22Preferences() = SecureAbove22Preferences(context, KEY_STORAGE_NAME)
fun getSecureAbove22Preferences() =
SecureAbove22Preferences(
context = context,
name = KEY_STORAGE_NAME,
forceInsecure = !Config.channel.isNightlyOrDebug
)
val passwordsEncryptionKey: String =
getSecureAbove22Preferences().getString(PASSWORDS_KEY)