Store session data in a secure way (#98)

* Replace SessionData DataStore with an encrypted SQLite DB.

---------

Co-authored-by: Benoit Marty <benoit@matrix.org>
This commit is contained in:
Jorge Martin Espinosa 2023-03-02 16:48:54 +01:00 committed by GitHub
parent 381bd3fd3f
commit 6677f80abe
38 changed files with 600 additions and 199 deletions

View file

@ -23,8 +23,9 @@ import app.cash.molecule.moleculeFlow
import app.cash.turbine.test
import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.architecture.Async
import io.element.android.libraries.matrix.core.SessionId
import io.element.android.libraries.matrixtest.A_SESSION_ID
import io.element.android.libraries.matrixtest.A_THROWABLE
import io.element.android.libraries.matrixtest.A_USER_ID
import io.element.android.libraries.matrixtest.FakeMatrixClient
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
@ -34,7 +35,7 @@ class LogoutPreferencePresenterTest {
@Test
fun `present - initial state`() = runTest {
val presenter = LogoutPreferencePresenter(
FakeMatrixClient(SessionId("sessionId")),
FakeMatrixClient(A_SESSION_ID),
)
moleculeFlow(RecompositionClock.Immediate) {
presenter.present()
@ -47,7 +48,7 @@ class LogoutPreferencePresenterTest {
@Test
fun `present - logout`() = runTest {
val presenter = LogoutPreferencePresenter(
FakeMatrixClient(SessionId("sessionId")),
FakeMatrixClient(A_SESSION_ID),
)
moleculeFlow(RecompositionClock.Immediate) {
presenter.present()
@ -63,7 +64,7 @@ class LogoutPreferencePresenterTest {
@Test
fun `present - logout with error`() = runTest {
val matrixClient = FakeMatrixClient(SessionId("sessionId"))
val matrixClient = FakeMatrixClient(A_SESSION_ID)
val presenter = LogoutPreferencePresenter(
matrixClient,
)