diff --git a/app/src/main/kotlin/com/wire/android/ui/settings/devices/DeviceDetailsViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/settings/devices/DeviceDetailsViewModel.kt index 421d1cc9e2..49e9db9ec1 100644 --- a/app/src/main/kotlin/com/wire/android/ui/settings/devices/DeviceDetailsViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/settings/devices/DeviceDetailsViewModel.kt @@ -177,7 +177,7 @@ class DeviceDetailsViewModel @Inject constructor( canBeRemoved = !result.isCurrentClient && isSelfClient && result.client.type != ClientType.LegalHold, mlsCipherSuiteSignature = MLSPublicKeyType.from( result.client.mlsPublicKeys?.keys?.firstOrNull().orEmpty() - ).value.toString() + ).let { mapCipherSuiteSignatureToShortName(it) } ) } } @@ -185,6 +185,17 @@ class DeviceDetailsViewModel @Inject constructor( } } + 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()) {