Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a crl revocation list to debug screen #2804

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/src/main/kotlin/com/wire/android/di/CoreLogicModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ class UseCaseModule {
@CurrentAccount currentAccount: UserId
) = coreLogic.getSessionScope(currentAccount).getPersistentWebSocketStatus

@ViewModelScoped
@Provides
fun provideCheckCrlRevocationListUseCase(@KaliumCoreLogic coreLogic: CoreLogic, @CurrentAccount currentAccount: UserId) =
coreLogic.getSessionScope(currentAccount).checkCrlRevocationList

@ViewModelScoped
@Provides
fun provideIsMLSEnabledUseCase(@KaliumCoreLogic coreLogic: CoreLogic, @CurrentAccount currentAccount: UserId) =
Expand Down
56 changes: 52 additions & 4 deletions app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import com.wire.kalium.logic.E2EIFailure
import com.wire.kalium.logic.data.user.UserId
import com.wire.kalium.logic.feature.debug.DisableEventProcessingUseCase
import com.wire.kalium.logic.feature.e2ei.CheckCrlRevocationListUseCase
import com.wire.kalium.logic.feature.e2ei.usecase.E2EIEnrollmentResult
import com.wire.kalium.logic.feature.keypackage.MLSKeyPackageCountResult
import com.wire.kalium.logic.feature.keypackage.MLSKeyPackageCountUseCase
Expand Down Expand Up @@ -98,6 +99,7 @@
private val mlsKeyPackageCountUseCase: MLSKeyPackageCountUseCase,
private val restartSlowSyncProcessForRecovery: RestartSlowSyncProcessForRecoveryUseCase,
private val disableEventProcessingUseCase: DisableEventProcessingUseCase,
private val checkCrlRevocationListUseCase: CheckCrlRevocationListUseCase

Check warning on line 102 in app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt#L102

Added line #L102 was not covered by tests
) : ViewModel() {

var state by mutableStateOf(
Expand All @@ -114,6 +116,14 @@
)
}

fun checkCrlRevocationList() {
viewModelScope.launch {
checkCrlRevocationListUseCase(
forceUpdate = true

Check warning on line 122 in app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt#L120-L122

Added lines #L120 - L122 were not covered by tests
)
}
}

fun enableEncryptedProteusStorage(enabled: Boolean) {
if (enabled) {
viewModelScope.launch {
Expand Down Expand Up @@ -248,7 +258,8 @@
onDisableEventProcessingChange = viewModel::disableEventProcessing,
enrollE2EICertificate = viewModel::enrollE2EICertificate,
handleE2EIEnrollmentResult = viewModel::handleE2EIEnrollmentResult,
dismissCertificateDialog = viewModel::dismissCertificateDialog
dismissCertificateDialog = viewModel::dismissCertificateDialog,
checkCrlRevocationList = viewModel::checkCrlRevocationList
)
}

Expand All @@ -266,7 +277,8 @@
onManualMigrationPressed: () -> Unit,
enrollE2EICertificate: () -> Unit,
handleE2EIEnrollmentResult: (Either<CoreFailure, E2EIEnrollmentResult>) -> Unit,
dismissCertificateDialog: () -> Unit
dismissCertificateDialog: () -> Unit,
checkCrlRevocationList: () -> Unit
) {
Column {

Expand Down Expand Up @@ -303,6 +315,16 @@
)
if (BuildConfig.PRIVATE_BUILD) {

SettingsItem(
title = stringResource(R.string.debug_id),
text = state.debugId,
trailingIcon = R.drawable.ic_copy,
onIconPressed = Clickable(
enabled = true,
onClick = { }
)
)

SettingsItem(
title = stringResource(R.string.debug_id),
text = state.debugId,
Expand Down Expand Up @@ -352,7 +374,8 @@
isEventProcessingEnabled = state.isEventProcessingDisabled,
onDisableEventProcessingChange = onDisableEventProcessingChange,
onRestartSlowSyncForRecovery = onRestartSlowSyncForRecovery,
onForceUpdateApiVersions = onForceUpdateApiVersions
onForceUpdateApiVersions = onForceUpdateApiVersions,
checkCrlRevocationList = checkCrlRevocationList
)
}

Expand Down Expand Up @@ -520,7 +543,8 @@
isEventProcessingEnabled: Boolean,
onDisableEventProcessingChange: (Boolean) -> Unit,
onRestartSlowSyncForRecovery: () -> Unit,
onForceUpdateApiVersions: () -> Unit
onForceUpdateApiVersions: () -> Unit,
checkCrlRevocationList: () -> Unit
) {
FolderHeader(stringResource(R.string.label_debug_tools_title))
Column {
Expand Down Expand Up @@ -548,6 +572,29 @@
)
}
)

// checkCrlRevocationList
RowItemTemplate(
modifier = Modifier.wrapContentWidth(),
title = {
Text(
style = MaterialTheme.wireTypography.body01,
color = MaterialTheme.wireColorScheme.onBackground,
text = "CRL revocation check",
modifier = Modifier.padding(start = dimensions().spacing8x)
)
},
actions = {
WirePrimaryButton(
minSize = MaterialTheme.wireDimensions.buttonMediumMinSize,
minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize,
onClick = checkCrlRevocationList,
text = stringResource(R.string.debug_settings_force_api_versioning_update_button_text),
fillMaxWidth = false
)
}
)

RowItemTemplate(
modifier = Modifier.wrapContentWidth(),
title = {
Expand Down Expand Up @@ -625,5 +672,6 @@
enrollE2EICertificate = {},
handleE2EIEnrollmentResult = {},
dismissCertificateDialog = {},
checkCrlRevocationList = {}
)
}
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/wire/android/ui/debug/DebugScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ fun DebugScreen(navigator: Navigator) {
private fun UserDebugContent(
onNavigationPressed: () -> Unit,
onManualMigrationPressed: (currentAccount: UserId) -> Unit,
) {
userDebugViewModel: UserDebugViewModel = hiltViewModel(),

val userDebugViewModel: UserDebugViewModel = hiltViewModel()
) {
val debugContentState: DebugContentState = rememberDebugContentState(userDebugViewModel.logPath)

WireScaffold(
Expand Down
2 changes: 1 addition & 1 deletion kalium
Submodule kalium updated 27 files
+2 −2 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/connection/ConnectionMapper.kt
+2 −4 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/e2ei/CertificateRevocationListRepository.kt
+4 −4 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/message/MessageMapper.kt
+4 −2 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/user/UserMapper.kt
+5 −2 logic/src/commonMain/kotlin/com/wire/kalium/logic/data/user/UserModel.kt
+9 −2 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt
+50 −0 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/e2ei/CheckCrlRevocationListUseCase.kt
+4 −6 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/e2ei/CertificateRevocationListRepositoryTest.kt
+2 −2 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/message/MessageMapperTest.kt
+63 −2 logic/src/commonTest/kotlin/com/wire/kalium/logic/data/user/UserMapperTest.kt
+1 −1 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/e2ei/CertificateRevocationListCheckWorkerTest.kt
+137 −0 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/e2ei/CheckCrlRevocationListUseCaseTest.kt
+2 −1 logic/src/commonTest/kotlin/com/wire/kalium/logic/framework/TestUser.kt
+20 −18 persistence/src/commonMain/db_user/com/wire/kalium/persistence/MessageDetailsView.sq
+5 −1 persistence/src/commonMain/db_user/com/wire/kalium/persistence/Users.sq
+204 −0 persistence/src/commonMain/db_user/migrations/80.sqm
+1 −1 persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/ConnectionDAO.kt
+1 −2 persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/ConnectionDAOImpl.kt
+2 −1 persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/UserDAO.kt
+5 −2 persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/UserDAOImpl.kt
+4 −4 persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageEntity.kt
+8 −4 persistence/src/commonMain/kotlin/com/wire/kalium/persistence/dao/message/MessageMapper.kt
+7 −7 persistence/src/commonTest/kotlin/com/wire/kalium/persistence/backup/DatabaseExporterTest.kt
+16 −13 persistence/src/commonTest/kotlin/com/wire/kalium/persistence/dao/message/MessageDAOTest.kt
+4 −0 persistence/src/commonTest/kotlin/com/wire/kalium/persistence/dao/message/MessageMapperTest.kt
+2 −2 persistence/src/commonTest/kotlin/com/wire/kalium/persistence/utils/stubs/MessageStubs.kt
+2 −1 persistence/src/commonTest/kotlin/com/wire/kalium/persistence/utils/stubs/UserStubs.kt
Loading