Skip to content

Commit bb6c146

Browse files
committed
fix: adjustments for short signature names (WPB-15188) (#3768)
1 parent 8753f31 commit bb6c146

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app/src/main/kotlin/com/wire/android/ui/settings/devices/DeviceDetailsViewModel.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,25 @@ class DeviceDetailsViewModel @Inject constructor(
177177
canBeRemoved = !result.isCurrentClient && isSelfClient && result.client.type != ClientType.LegalHold,
178178
mlsCipherSuiteSignature = MLSPublicKeyType.from(
179179
result.client.mlsPublicKeys?.keys?.firstOrNull().orEmpty()
180-
).value.toString()
180+
).let { mapCipherSuiteSignatureToShortName(it) }
181181
)
182182
}
183183
}
184184
}
185185
}
186186
}
187187

188+
private fun mapCipherSuiteSignatureToShortName(signature: MLSPublicKeyType): String {
189+
return when (signature) {
190+
MLSPublicKeyType.ECDSA_SECP256R1_SHA256 -> "P256"
191+
MLSPublicKeyType.ECDSA_SECP384R1_SHA384 -> "P384"
192+
MLSPublicKeyType.ECDSA_SECP521R1_SHA512 -> "P521"
193+
MLSPublicKeyType.ED25519 -> "ED25519"
194+
MLSPublicKeyType.ED448 -> "ED448"
195+
is MLSPublicKeyType.Unknown -> "Unknown"
196+
}
197+
}
198+
188199
fun removeDevice(onSuccess: () -> Unit) {
189200
viewModelScope.launch {
190201
val isPasswordRequired: Boolean = when (val passwordRequiredResult = isPasswordRequired()) {

0 commit comments

Comments
 (0)