mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 20:38:40 +00:00
Merge pull request #2704 from element-hq/feature/bma/encryptDbRelease
Encrypt new session data with a passphrase
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
Encrypt new session data with a passphrase
|
||||||
-10
@@ -19,8 +19,6 @@ package io.element.android.libraries.matrix.impl.auth
|
|||||||
import com.squareup.anvil.annotations.ContributesBinding
|
import com.squareup.anvil.annotations.ContributesBinding
|
||||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||||
import io.element.android.libraries.core.extensions.mapFailure
|
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.AppScope
|
||||||
import io.element.android.libraries.di.SingleIn
|
import io.element.android.libraries.di.SingleIn
|
||||||
import io.element.android.libraries.matrix.api.MatrixClient
|
import io.element.android.libraries.matrix.api.MatrixClient
|
||||||
@@ -60,7 +58,6 @@ class RustMatrixAuthenticationService @Inject constructor(
|
|||||||
private val passphraseGenerator: PassphraseGenerator,
|
private val passphraseGenerator: PassphraseGenerator,
|
||||||
userCertificatesProvider: UserCertificatesProvider,
|
userCertificatesProvider: UserCertificatesProvider,
|
||||||
proxyProvider: ProxyProvider,
|
proxyProvider: ProxyProvider,
|
||||||
private val buildMeta: BuildMeta,
|
|
||||||
) : MatrixAuthenticationService {
|
) : MatrixAuthenticationService {
|
||||||
// Passphrase which will be used for new sessions. Existing sessions will use the passphrase
|
// Passphrase which will be used for new sessions. Existing sessions will use the passphrase
|
||||||
// stored in the SessionData.
|
// stored in the SessionData.
|
||||||
@@ -110,13 +107,6 @@ class RustMatrixAuthenticationService @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getDatabasePassphrase(): String? {
|
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()
|
val passphrase = passphraseGenerator.generatePassphrase()
|
||||||
if (passphrase != null) {
|
if (passphrase != null) {
|
||||||
Timber.w("New sessions will be encrypted with a passphrase")
|
Timber.w("New sessions will be encrypted with a passphrase")
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ class MainActivity : ComponentActivity() {
|
|||||||
utdTracker = UtdTracker(NoopAnalyticsService()),
|
utdTracker = UtdTracker(NoopAnalyticsService()),
|
||||||
),
|
),
|
||||||
passphraseGenerator = NullPassphraseGenerator(),
|
passphraseGenerator = NullPassphraseGenerator(),
|
||||||
buildMeta = Singleton.buildMeta,
|
|
||||||
userCertificatesProvider = userCertificatesProvider,
|
userCertificatesProvider = userCertificatesProvider,
|
||||||
proxyProvider = proxyProvider,
|
proxyProvider = proxyProvider,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user