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

fix: back port general mls fixes - 4.6 (WPB-15040) #3793

Merged
merged 5 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,10 @@ fun GroupConversationSettings(
onCheckedChange = onReadReceiptSwitchClicked
)
}
if (state.mlsEnabled) {
item {
ConversationProtocolDetails(
protocolInfo = state.protocolInfo
)
}
item {
ConversationProtocolDetails(
protocolInfo = state.protocolInfo
)
}
}
}
Expand All @@ -171,29 +169,27 @@ fun ConversationProtocolDetails(
) {
Column {
FolderHeader(name = stringResource(R.string.folder_label_protocol_details))
if (protocolInfo is Conversation.ProtocolInfo.MLS || BuildConfig.MLS_SUPPORT_ENABLED) {
ProtocolDetails(
label = UIText.StringResource(R.string.protocol),
text = UIText.DynamicString(protocolInfo.name())
)

if (protocolInfo is Conversation.ProtocolInfo.MLS) {
ProtocolDetails(
label = UIText.StringResource(R.string.protocol),
text = UIText.DynamicString(protocolInfo.name())
label = UIText.StringResource(R.string.cipher_suite),
text = UIText.DynamicString(protocolInfo.cipherSuite.toString())
)

if (protocolInfo is Conversation.ProtocolInfo.MLS) {
if (BuildConfig.PRIVATE_BUILD) {
ProtocolDetails(
label = UIText.StringResource(R.string.cipher_suite),
text = UIText.DynamicString(protocolInfo.cipherSuite.toString())
label = UIText.StringResource(R.string.last_key_material_update_label),
text = UIText.DynamicString(protocolInfo.keyingMaterialLastUpdate.toString())
)

if (BuildConfig.PRIVATE_BUILD) {
ProtocolDetails(
label = UIText.StringResource(R.string.last_key_material_update_label),
text = UIText.DynamicString(protocolInfo.keyingMaterialLastUpdate.toString())
)

ProtocolDetails(
label = UIText.StringResource(R.string.group_state_label),
text = UIText.DynamicString(protocolInfo.groupState.name)
)
}
ProtocolDetails(
label = UIText.StringResource(R.string.group_state_label),
text = UIText.DynamicString(protocolInfo.groupState.name)
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ fun DeviceDetailsContent(
) {
state.device.mlsClientIdentity?.let { identity ->
item {
FolderHeader(
name = stringResource(id = R.string.label_mls_signature, state.mlsCipherSuiteSignature.orEmpty()).uppercase(),
modifier = Modifier
.background(MaterialTheme.wireColorScheme.background)
.fillMaxWidth()
)
DeviceMLSSignatureItem(identity.thumbprint, screenState::copyMessage)
Divider(color = MaterialTheme.wireColorScheme.background)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import com.wire.kalium.logic.CoreFailure
import com.wire.kalium.logic.data.client.ClientType
import com.wire.kalium.logic.data.client.DeleteClientParam
import com.wire.kalium.logic.data.conversation.ClientId
import com.wire.kalium.logic.data.mlspublickeys.MLSPublicKeyType
import com.wire.kalium.logic.data.user.UserId
import com.wire.kalium.logic.feature.client.ClientFingerprintUseCase
import com.wire.kalium.logic.feature.client.DeleteClientResult
Expand Down Expand Up @@ -174,13 +175,27 @@ class DeviceDetailsViewModel @Inject constructor(
isCurrentDevice = result.isCurrentClient,
removeDeviceDialogState = RemoveDeviceDialogState.Hidden,
canBeRemoved = !result.isCurrentClient && isSelfClient && result.client.type == ClientType.Permanent,
mlsCipherSuiteSignature = MLSPublicKeyType.from(
result.client.mlsPublicKeys?.keys?.firstOrNull().orEmpty()
).let { mapCipherSuiteSignatureToShortName(it) }
)
}
}
}
}
}

private fun mapCipherSuiteSignatureToShortName(signature: MLSPublicKeyType): String {
return when (signature) {
MLSPublicKeyType.ECDSA_SECP256R1_SHA256 -> "P256"
MLSPublicKeyType.ECDSA_SECP384R1_SHA384 -> "P384"
MLSPublicKeyType.ECDSA_SECP521R1_SHA512 -> "P521"
MLSPublicKeyType.ED25519 -> "ED25519"
MLSPublicKeyType.ED448 -> "ED448"
is MLSPublicKeyType.Unknown -> "Unknown"
}
}

fun removeDevice(onSuccess: () -> Unit) {
viewModelScope.launch {
val isPasswordRequired: Boolean = when (val passwordRequiredResult = isPasswordRequired()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ data class DeviceDetailsState(
val isE2EICertificateEnrollSuccess: Boolean = false,
val isE2EICertificateEnrollError: Boolean = false,
val isE2EIEnabled: Boolean = false,
val startGettingE2EICertificate: Boolean = false
val startGettingE2EICertificate: Boolean = false,
val mlsCipherSuiteSignature: String? = null,
)
2 changes: 1 addition & 1 deletion kalium
Submodule kalium updated 20 files
+5 −1 logic/src/commonMain/kotlin/com/wire/kalium/logic/configuration/server/CustomServerConfigRepository.kt
+18 −6 logic/src/commonMain/kotlin/com/wire/kalium/logic/configuration/server/ServerConfigRepository.kt
+2 −1 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/UserSessionScope.kt
+20 −4 .../src/commonMain/kotlin/com/wire/kalium/logic/feature/conversation/GetOrCreateOneToOneConversationUseCase.kt
+49 −13 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/conversation/mls/OneOnOneMigrator.kt
+11 −2 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/conversation/mls/OneOnOneResolver.kt
+15 −6 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/protocol/OneOnOneProtocolSelector.kt
+1 −1 logic/src/commonMain/kotlin/com/wire/kalium/logic/feature/server/UpdateApiVersionsUseCase.kt
+13 −12 logic/src/commonTest/kotlin/com/wire/kalium/logic/configuration/CustomServerConfigRepositoryTest.kt
+4 −4 logic/src/commonTest/kotlin/com/wire/kalium/logic/configuration/ServerConfigRepositoryTest.kt
+52 −7 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/conversation/mls/OneOnOneMigratorTest.kt
+20 −0 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/conversation/mls/OneOnOneResolverTest.kt
+0 −42 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/protocol/OneOnOneProtocolSelectorTest.kt
+13 −13 logic/src/commonTest/kotlin/com/wire/kalium/logic/feature/server/UpdateApiVersionUseCaseTest.kt
+9 −0 logic/src/commonTest/kotlin/com/wire/kalium/logic/util/arrangement/mls/OneOnOneMigratorArrangement.kt
+6 −0 logic/src/commonTest/kotlin/com/wire/kalium/logic/util/arrangement/repository/MessageRepositoryArrangement.kt
+2 −2 persistence/src/commonMain/db_global/com/wire/kalium/persistence/ServerConfiguration.sq
+5 −3 persistence/src/commonMain/kotlin/com/wire/kalium/persistence/daokaliumdb/ServerConfigurationDAO.kt
+34 −7 persistence/src/commonTest/kotlin/com/wire/kalium/persistence/daokaliumdb/ServerConfigurationDAOTest.kt
+7 −0 persistence/src/commonTest/kotlin/com/wire/kalium/persistence/globalDB/AccountsDAOTest.kt
Loading