Encrypt new session data with a passphrase #2703
This commit is contained in:
parent
e8d8ee389a
commit
ae09b5b69c
3 changed files with 1 additions and 11 deletions
1
changelog.d/2703.misc
Normal file
1
changelog.d/2703.misc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Encrypt new session data with a passphrase
|
||||||
|
|
@ -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,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue