Support SCAN method (WIP)

This commit is contained in:
Benoit Marty 2020-01-23 10:47:29 +01:00
parent 37b950897f
commit b3089343ad
6 changed files with 17 additions and 11 deletions

View file

@ -31,9 +31,9 @@ class SharedSecretTest : InstrumentedTest {
@Test
fun testSharedSecretLengthCase() {
val sharedSecret = generateSharedSecret()
sharedSecret.length shouldBe 43
repeat(100) {
generateSharedSecret().length shouldBe 43
}
}
@Test

View file

@ -21,6 +21,5 @@ package im.vector.matrix.android.api.session.crypto.sas
*/
enum class VerificationMethod {
SAS,
// Not supported yet
SCAN
}

View file

@ -28,5 +28,8 @@ internal fun VerificationMethod.toValue(): String {
}
}
// TODO Add SCAN
internal val supportedVerificationMethods = listOf(VERIFICATION_METHOD_SAS)
internal val supportedVerificationMethods =
listOf(
VERIFICATION_METHOD_SAS,
VERIFICATION_METHOD_SCAN
)

View file

@ -37,8 +37,8 @@ internal interface SasTransport {
fun sendVerificationRequest(supportedMethods: List<String>,
localID: String,
otherUserId: String,
roomId: String, callback:
(String?, MessageVerificationRequestContent?) -> Unit)
roomId: String,
callback: (String?, MessageVerificationRequestContent?) -> Unit)
fun cancelTransaction(transactionId: String,
otherUserId: String,

View file

@ -18,5 +18,8 @@ package im.vector.riotx.features.crypto.verification
import im.vector.matrix.android.api.session.crypto.sas.VerificationMethod
// TODO Add support for SCAN (QR code)
val supportedVerificationMethods = listOf(VerificationMethod.SAS)
val supportedVerificationMethods =
listOf(
VerificationMethod.SAS,
VerificationMethod.SCAN
)

View file

@ -1027,7 +1027,8 @@ class RoomDetailFragment @Inject constructor(
}
override fun onAvatarClicked(informationData: MessageInformationData) {
openRoomMemberProfile(informationData.senderId)
// DO NOT COMMIT openRoomMemberProfile(informationData.senderId)
roomDetailViewModel.handle(RoomDetailAction.RequestVerification(informationData.senderId))
}
private fun openRoomMemberProfile(userId: String) {