Request changes from review
This commit is contained in:
parent
67be8c3c40
commit
4f652f1026
|
@ -46,11 +46,6 @@ class ECDHRendezvousChannel(override var transport: RendezvousTransport, theirPu
|
|||
private const val ALGORITHM_SPEC = "AES/GCM/NoPadding"
|
||||
private const val KEY_SPEC = "AES"
|
||||
private val TAG = LoggerTag(ECDHRendezvousChannel::class.java.simpleName, LoggerTag.RENDEZVOUS).value
|
||||
|
||||
// this is the same representation as for SAS but we delimit by dashes instead of spaces for readability
|
||||
private fun getDecimalCodeRepresentation(byteArray: ByteArray): String {
|
||||
return SASDefaultVerificationTransaction.getDecimalCodeRepresentation(byteArray).replace(" ", "-")
|
||||
}
|
||||
}
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
|
@ -114,7 +109,7 @@ class ECDHRendezvousChannel(override var transport: RendezvousTransport, theirPu
|
|||
aesKey = sas.generateShortCode(aesInfo, 32)
|
||||
|
||||
val rawChecksum = sas.generateShortCode(aesInfo, 5)
|
||||
return getDecimalCodeRepresentation(rawChecksum)
|
||||
return SASDefaultVerificationTransaction.getDecimalCodeRepresentation(rawChecksum, separator = "-")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.matrix.android.sdk.api.rendezvous.model.SimpleHttpRendezvousTransport
|
|||
import timber.log.Timber
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* Implementation of the Simple HTTP transport MSC3886: https://github.com/matrix-org/matrix-spec-proposals/pull/3886
|
||||
|
@ -87,7 +88,7 @@ class SimpleHttpRendezvousTransport(rendezvousUri: String?) : RendezvousTranspor
|
|||
val location = response.header("location") ?: throw RuntimeException("No rendezvous URI found in response")
|
||||
|
||||
response.header("expires")?.let {
|
||||
val format = SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz")
|
||||
val format = SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US)
|
||||
expiresAt = format.parse(it)
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ internal abstract class SASDefaultVerificationTransaction(
|
|||
* The three 4-digit numbers are displayed to the user either with dashes (or another appropriate separator) separating the three numbers,
|
||||
* or with the three numbers on separate lines.
|
||||
*/
|
||||
fun getDecimalCodeRepresentation(byteArray: ByteArray): String {
|
||||
fun getDecimalCodeRepresentation(byteArray: ByteArray, separator: String = " "): String {
|
||||
val b0 = byteArray[0].toUnsignedInt() // need unsigned byte
|
||||
val b1 = byteArray[1].toUnsignedInt() // need unsigned byte
|
||||
val b2 = byteArray[2].toUnsignedInt() // need unsigned byte
|
||||
|
@ -107,7 +107,7 @@ internal abstract class SASDefaultVerificationTransaction(
|
|||
val second = ((b1 and 0x7).shl(10) or b2.shl(2) or b3.shr(6)) + 1000
|
||||
// ((B3 & 0x3f) << 7 | B4 >> 1) + 1000
|
||||
val third = ((b3 and 0x3f).shl(7) or b4.shr(1)) + 1000
|
||||
return "$first $second $third"
|
||||
return "$first$separator$second$separator$third"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue