QrCode: WIP

This commit is contained in:
Benoit Marty 2020-01-27 19:57:40 +01:00
parent 8659216955
commit d8d465f70b
3 changed files with 10 additions and 2 deletions

View File

@ -687,6 +687,7 @@ internal class DefaultVerificationService @Inject constructor(
cryptoStore,
qrCodeData.sharedSecret,
qrCodeData.toUrl(),
userId,
deviceId ?: "",
false)
@ -1011,7 +1012,6 @@ internal class DefaultVerificationService @Inject constructor(
result.add(VERIFICATION_METHOD_QR_CODE_SHOW)
result.add(VERIFICATION_METHOD_RECIPROCATE)
// Create the pending request, to display the QR code
// Create the pending transaction
val tx = DefaultQrCodeVerificationTransaction(
transactionId,
@ -1021,6 +1021,7 @@ internal class DefaultVerificationService @Inject constructor(
cryptoStore,
qrCodeData.sharedSecret,
qrCodeData.toUrl(),
userId,
deviceId ?: "",
false)

View File

@ -38,6 +38,7 @@ internal class DefaultQrCodeVerificationTransaction(
private val cryptoStore: IMXCryptoStore,
private val myGeneratedSecret: String,
override val qrCodeText: String,
val userId: String,
val deviceId: String,
override val isIncoming: Boolean
) : DefaultVerificationTransaction(transactionId, otherUserId, otherDeviceId, isIncoming), QrCodeVerificationTransaction {
@ -71,7 +72,7 @@ internal class DefaultQrCodeVerificationTransaction(
}
// check master key
if (qrCodeData.otherUserKey != crossSigningService.getUserCrossSigningKeys(otherUserId)?.masterKey()?.unpaddedBase64PublicKey) {
if (qrCodeData.otherUserKey != crossSigningService.getUserCrossSigningKeys(userId)?.masterKey()?.unpaddedBase64PublicKey) {
return CancelCode.MismatchedKeys
}

View File

@ -46,6 +46,7 @@ import im.vector.riotx.core.di.HasScreenInjector
import im.vector.riotx.core.platform.EmptyViewEvents
import im.vector.riotx.core.platform.VectorViewModel
import im.vector.riotx.core.utils.LiveEvent
import timber.log.Timber
data class VerificationBottomSheetViewState(
val otherUserMxItem: MatrixItem? = null,
@ -175,6 +176,11 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(@Assisted ini
.getExistingTransaction(action.otherUserId, action.transactionId) as? QrCodeVerificationTransaction
existingTransaction
?.userHasScannedRemoteQrCode(action.scannedData)
?.let { cancelCode ->
// Something went wrong
Timber.w("## Something is not right: $cancelCode")
// TODO
}
}
is VerificationAction.SASMatchAction -> {
(session.getVerificationService()