Encrypt new session data with a passphrase #2703

This commit is contained in:
Benoit Marty
2024-04-15 11:02:16 +02:00
parent e8d8ee389a
commit ae09b5b69c
3 changed files with 1 additions and 11 deletions

1
changelog.d/2703.misc Normal file
View File

@@ -0,0 +1 @@
Encrypt new session data with a passphrase

View File

@@ -19,8 +19,6 @@ package io.element.android.libraries.matrix.impl.auth
import com.squareup.anvil.annotations.ContributesBinding
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
import io.element.android.libraries.core.extensions.mapFailure
import io.element.android.libraries.core.meta.BuildMeta
import io.element.android.libraries.core.meta.BuildType
import io.element.android.libraries.di.AppScope
import io.element.android.libraries.di.SingleIn
import io.element.android.libraries.matrix.api.MatrixClient
@@ -60,7 +58,6 @@ class RustMatrixAuthenticationService @Inject constructor(
private val passphraseGenerator: PassphraseGenerator,
userCertificatesProvider: UserCertificatesProvider,
proxyProvider: ProxyProvider,
private val buildMeta: BuildMeta,
) : MatrixAuthenticationService {
// Passphrase which will be used for new sessions. Existing sessions will use the passphrase
// stored in the SessionData.
@@ -110,13 +107,6 @@ class RustMatrixAuthenticationService @Inject constructor(
}
private fun getDatabasePassphrase(): String? {
// TODO Remove this if block at some point
// Return a passphrase only for debug and nightly build for now
if (buildMeta.buildType == BuildType.RELEASE) {
Timber.w("New sessions will not be encrypted with a passphrase (release build)")
return null
}
val passphrase = passphraseGenerator.generatePassphrase()
if (passphrase != null) {
Timber.w("New sessions will be encrypted with a passphrase")

View File

@@ -64,7 +64,6 @@ class MainActivity : ComponentActivity() {
utdTracker = UtdTracker(NoopAnalyticsService()),
),
passphraseGenerator = NullPassphraseGenerator(),
buildMeta = Singleton.buildMeta,
userCertificatesProvider = userCertificatesProvider,
proxyProvider = proxyProvider,
)