From 5d0e917f04206bbac82f4200cb522301c80d179e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 6 Mar 2020 13:50:00 +0100 Subject: [PATCH] Rename to respect naming convention #2 --- .../ValidVerificationInfoReady.kt | 2 +- .../ValidVerificationInfoRequest.kt | 2 +- .../message/MessageVerificationDoneContent.kt | 2 +- ...tgoingSASDefaultVerificationTransaction.kt | 2 +- .../DefaultVerificationService.kt | 56 +++++++++---------- .../verification/VerificationInfoAccept.kt | 2 +- .../verification/VerificationInfoCancel.kt | 2 +- .../verification/VerificationInfoKey.kt | 2 +- .../verification/VerificationInfoMac.kt | 2 +- .../verification/VerificationInfoStart.kt | 10 ++-- .../verification/VerificationTransport.kt | 4 +- .../VerificationTransportRoomMessage.kt | 10 ++-- .../VerificationTransportToDevice.kt | 12 ++-- .../room/send/LocalEchoEventFactory.kt | 2 +- 14 files changed, 55 insertions(+), 55 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/ValidVerificationInfoReady.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/ValidVerificationInfoReady.kt index 818e491d88a..db70e2d19f2 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/ValidVerificationInfoReady.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/ValidVerificationInfoReady.kt @@ -17,7 +17,7 @@ package im.vector.matrix.android.api.session.crypto.verification data class ValidVerificationInfoReady( - val transactionID: String, + val transactionId: String, val fromDevice: String, val methods: List ) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/ValidVerificationInfoRequest.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/ValidVerificationInfoRequest.kt index 720e6fb29cd..9ef148f02f5 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/ValidVerificationInfoRequest.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/verification/ValidVerificationInfoRequest.kt @@ -17,7 +17,7 @@ package im.vector.matrix.android.api.session.crypto.verification data class ValidVerificationInfoRequest( - val transactionID: String, + val transactionId: String, val fromDevice: String, val methods: List, val timestamp: Long? diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageVerificationDoneContent.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageVerificationDoneContent.kt index e102f9f4f41..509b63e831b 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageVerificationDoneContent.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/room/model/message/MessageVerificationDoneContent.kt @@ -42,5 +42,5 @@ internal data class MessageVerificationDoneContent( } internal data class ValidVerificationDone( - val transactionID: String + val transactionId: String ) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationTransaction.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationTransaction.kt index 9c854d27946..85ab8f0bf61 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationTransaction.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationTransaction.kt @@ -118,7 +118,7 @@ internal class DefaultOutgoingSASDefaultVerificationTransaction( // fromDevice = session.sessionParams.credentials.deviceId ?: "", // methods = listOf(KeyVerificationStart.VERIF_METHOD_SAS), // timestamp = System.currentTimeMillis().toInt(), -// transactionID = transactionId +// transactionId = transactionId // ) // // sendToOther( diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultVerificationService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultVerificationService.kt index 098973f4895..75b5217dc79 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultVerificationService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultVerificationService.kt @@ -300,8 +300,8 @@ internal class DefaultVerificationService @Inject constructor( isIncoming = true, otherUserId = senderId, // requestInfo.toUserId, roomId = null, - transactionId = validRequestInfo.transactionID, - localID = validRequestInfo.transactionID, + transactionId = validRequestInfo.transactionId, + localID = validRequestInfo.transactionId, requestInfo = validRequestInfo ) requestsForUser.add(pendingVerificationRequest) @@ -313,7 +313,7 @@ internal class DefaultVerificationService @Inject constructor( val requestInfo = event.getClearContent().toModel() ?: return val validRequestInfo = requestInfo // copy the EventId to the transactionId - .copy(transactionID = event.eventId) + .copy(transactionId = event.eventId) .asValidObject() ?: return val senderId = event.senderId ?: return @@ -373,10 +373,10 @@ internal class DefaultVerificationService @Inject constructor( val otherUserId = event.senderId if (validStartReq == null) { Timber.e("## received invalid verification request") - if (startReq?.transactionID != null) { + if (startReq?.transactionId != null) { verificationTransportRoomMessageFactory.createTransport(event.roomId ?: "", null) .cancelTransaction( - startReq.transactionID ?: "", + startReq.transactionId ?: "", otherUserId!!, startReq.fromDevice ?: event.getSenderKey()!!, CancelCode.UnknownMethod @@ -390,7 +390,7 @@ internal class DefaultVerificationService @Inject constructor( }?.let { verificationTransportRoomMessageFactory.createTransport(event.roomId ?: "", null) .cancelTransaction( - validStartReq.transactionID, + validStartReq.transactionId, otherUserId!!, validStartReq.fromDevice, it @@ -407,9 +407,9 @@ internal class DefaultVerificationService @Inject constructor( val otherUserId = event.senderId!! if (validStartReq == null) { Timber.e("## SAS received invalid verification request") - if (startReq?.transactionID != null) { + if (startReq?.transactionId != null) { verificationTransportToDeviceFactory.createTransport(null).cancelTransaction( - startReq.transactionID, + startReq.transactionId, otherUserId, startReq.fromDevice ?: event.getSenderKey()!!, CancelCode.UnknownMethod @@ -422,7 +422,7 @@ internal class DefaultVerificationService @Inject constructor( it.transport = verificationTransportToDeviceFactory.createTransport(it) }?.let { verificationTransportToDeviceFactory.createTransport(null).cancelTransaction( - validStartReq.transactionID, + validStartReq.transactionId, otherUserId, validStartReq.fromDevice, it @@ -436,9 +436,9 @@ internal class DefaultVerificationService @Inject constructor( private suspend fun handleStart(otherUserId: String?, startReq: ValidVerificationInfoStart, txConfigure: (DefaultVerificationTransaction) -> Unit): CancelCode? { - Timber.d("## SAS onStartRequestReceived ${startReq.transactionID}") + Timber.d("## SAS onStartRequestReceived ${startReq.transactionId}") if (checkKeysAreDownloaded(otherUserId!!, startReq.fromDevice) != null) { - val tid = startReq.transactionID + val tid = startReq.transactionId val existing = getExistingTransaction(otherUserId, tid) when (startReq) { @@ -446,7 +446,7 @@ internal class DefaultVerificationService @Inject constructor( when (existing) { is SasVerificationTransaction -> { // should cancel both! - Timber.v("## SAS onStartRequestReceived - Request exist with same id ${startReq.transactionID}") + Timber.v("## SAS onStartRequestReceived - Request exist with same id ${startReq.transactionId}") existing.cancel(CancelCode.UnexpectedMessage) // Already cancelled, so return null return null @@ -461,7 +461,7 @@ internal class DefaultVerificationService @Inject constructor( ?.also { // Multiple keyshares between two devices: // any two devices may only have at most one key verification in flight at a time. - Timber.v("## SAS onStartRequestReceived - Already a transaction with this user ${startReq.transactionID}") + Timber.v("## SAS onStartRequestReceived - Already a transaction with this user ${startReq.transactionId}") } ?.forEach { it.cancel(CancelCode.UnexpectedMessage) @@ -473,12 +473,12 @@ internal class DefaultVerificationService @Inject constructor( } // Ok we can create a SAS transaction - Timber.v("## SAS onStartRequestReceived - request accepted ${startReq.transactionID}") + Timber.v("## SAS onStartRequestReceived - request accepted ${startReq.transactionId}") // If there is a corresponding request, we can auto accept // as we are the one requesting in first place (or we accepted the request) // I need to check if the pending request was related to this device also val autoAccept = getExistingVerificationRequest(otherUserId)?.any { - it.transactionId == startReq.transactionID + it.transactionId == startReq.transactionId && (it.requestInfo?.fromDevice == this.deviceId || it.readyInfo?.fromDevice == this.deviceId) } ?: false @@ -490,7 +490,7 @@ internal class DefaultVerificationService @Inject constructor( cryptoStore, crossSigningService, myDeviceInfoHolder.get().myDevice.fingerprint()!!, - startReq.transactionID, + startReq.transactionId, otherUserId, autoAccept).also { txConfigure(it) } addTransaction(tx) @@ -503,7 +503,7 @@ internal class DefaultVerificationService @Inject constructor( existing.onStartReceived(startReq) return null } else { - Timber.w("## SAS onStartRequestReceived - unexpected message ${startReq.transactionID}") + Timber.w("## SAS onStartRequestReceived - unexpected message ${startReq.transactionId}") return CancelCode.UnexpectedMessage } } @@ -545,7 +545,7 @@ internal class DefaultVerificationService @Inject constructor( // TODO should we cancel? return } - getExistingVerificationRequest(event.senderId ?: "", validCancelReq.transactionID)?.let { + getExistingVerificationRequest(event.senderId ?: "", validCancelReq.transactionId)?.let { updatePendingRequest(it.copy(cancelConclusion = safeValueOf(validCancelReq.code))) // Should we remove it from the list? } @@ -569,8 +569,8 @@ internal class DefaultVerificationService @Inject constructor( private fun handleOnCancel(otherUserId: String, cancelReq: ValidVerificationInfoCancel) { Timber.v("## SAS onCancelReceived otherUser: $otherUserId reason: ${cancelReq.reason}") - val existingTransaction = getExistingTransaction(otherUserId, cancelReq.transactionID) - val existingRequest = getExistingVerificationRequest(otherUserId, cancelReq.transactionID) + val existingTransaction = getExistingTransaction(otherUserId, cancelReq.transactionId) + val existingRequest = getExistingVerificationRequest(otherUserId, cancelReq.transactionId) if (existingRequest != null) { // Mark this request as cancelled @@ -606,7 +606,7 @@ internal class DefaultVerificationService @Inject constructor( private fun handleAccept(acceptReq: ValidVerificationInfoAccept, senderId: String) { val otherUserId = senderId - val existing = getExistingTransaction(otherUserId, acceptReq.transactionID) + val existing = getExistingTransaction(otherUserId, acceptReq.transactionId) if (existing == null) { Timber.e("## SAS Received invalid accept request") return @@ -649,7 +649,7 @@ internal class DefaultVerificationService @Inject constructor( private fun handleKeyReceived(event: Event, keyReq: ValidVerificationInfoKey) { Timber.d("## SAS Received Key from ${event.senderId} with info $keyReq") val otherUserId = event.senderId!! - val existing = getExistingTransaction(otherUserId, keyReq.transactionID) + val existing = getExistingTransaction(otherUserId, keyReq.transactionId) if (existing == null) { Timber.e("## SAS Received invalid key request") return @@ -752,7 +752,7 @@ internal class DefaultVerificationService @Inject constructor( private fun handleMacReceived(senderId: String, macReq: ValidVerificationInfoMac) { Timber.v("## SAS Received $macReq") - val existing = getExistingTransaction(senderId, macReq.transactionID) + val existing = getExistingTransaction(senderId, macReq.transactionId) if (existing == null) { Timber.e("## SAS Received invalid Mac request") return @@ -767,9 +767,9 @@ internal class DefaultVerificationService @Inject constructor( private fun handleReadyReceived(senderId: String, readyReq: ValidVerificationInfoReady, transportCreator: (DefaultVerificationTransaction) -> VerificationTransport) { - val existingRequest = getExistingVerificationRequest(senderId)?.find { it.transactionId == readyReq.transactionID } + val existingRequest = getExistingVerificationRequest(senderId)?.find { it.transactionId == readyReq.transactionId } if (existingRequest == null) { - Timber.e("## SAS Received Ready for unknown request txId:${readyReq.transactionID} fromDevice ${readyReq.fromDevice}") + Timber.e("## SAS Received Ready for unknown request txId:${readyReq.transactionId} fromDevice ${readyReq.fromDevice}") return } @@ -784,7 +784,7 @@ internal class DefaultVerificationService @Inject constructor( // Create the pending transaction val tx = DefaultQrCodeVerificationTransaction( setDeviceVerificationAction, - readyReq.transactionID, + readyReq.transactionId, senderId, readyReq.fromDevice, crossSigningService, @@ -899,9 +899,9 @@ internal class DefaultVerificationService @Inject constructor( } private fun handleDoneReceived(senderId: String, doneInfo: ValidVerificationDone) { - val existingRequest = getExistingVerificationRequest(senderId)?.find { it.transactionId == doneInfo.transactionID } + val existingRequest = getExistingVerificationRequest(senderId)?.find { it.transactionId == doneInfo.transactionId } if (existingRequest == null) { - Timber.e("## SAS Received Done for unknown request txId:${doneInfo.transactionID}") + Timber.e("## SAS Received Done for unknown request txId:${doneInfo.transactionId}") return } updatePendingRequest(existingRequest.copy(isSuccessful = true)) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoAccept.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoAccept.kt index 1997f85bec1..a49d1c6da89 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoAccept.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoAccept.kt @@ -72,7 +72,7 @@ internal interface VerificationInfoAcceptFactory { } internal data class ValidVerificationInfoAccept( - val transactionID: String, + val transactionId: String, val keyAgreementProtocol: String, val hash: String, val messageAuthenticationCode: String, diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoCancel.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoCancel.kt index b82fe19262a..55603f69a2d 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoCancel.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoCancel.kt @@ -39,7 +39,7 @@ internal interface VerificationInfoCancel : VerificationInfo, val keys: String ) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoStart.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoStart.kt index fcbceb83ebb..7fb2bddc47b 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoStart.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationInfoStart.kt @@ -104,21 +104,21 @@ internal interface VerificationInfoStart : VerificationInfo, val hashes: List, val messageAuthenticationCodes: List, val shortAuthenticationStrings: List, val canonicalJson: String - ) : ValidVerificationInfoStart(transactionID, fromDevice) + ) : ValidVerificationInfoStart(transactionId, fromDevice) data class ReciprocateVerificationInfoStart( - override val transactionID: String, + override val transactionId: String, override val fromDevice: String, val sharedSecret: String - ) : ValidVerificationInfoStart(transactionID, fromDevice) + ) : ValidVerificationInfoStart(transactionId, fromDevice) } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransport.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransport.kt index db3255a28f2..f3192df4e1e 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransport.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransport.kt @@ -65,7 +65,7 @@ internal interface VerificationTransport { * Create start for SAS verification */ fun createStartForSas(fromDevice: String, - transactionID: String, + transactionId: String, keyAgreementProtocols: List, hashes: List, messageAuthenticationCodes: List, @@ -75,7 +75,7 @@ internal interface VerificationTransport { * Create start for QR code verification */ fun createStartForQrCode(fromDevice: String, - transactionID: String, + transactionId: String, sharedSecret: String): VerificationInfoStart fun createMac(tid: String, mac: Map, keys: String): VerificationInfoMac diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransportRoomMessage.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransportRoomMessage.kt index 09330d1ad7a..141c09f3d4d 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransportRoomMessage.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransportRoomMessage.kt @@ -147,7 +147,7 @@ internal class VerificationTransportRoomMessage( requireNotNull(roomId) val validInfo = ValidVerificationInfoRequest( - transactionID = "", + transactionId = "", fromDevice = userDeviceId ?: "", methods = supportedMethods, timestamp = System.currentTimeMillis() @@ -278,7 +278,7 @@ internal class VerificationTransportRoomMessage( override fun createMac(tid: String, mac: Map, keys: String) = MessageVerificationMacContent.create(tid, mac, keys) override fun createStartForSas(fromDevice: String, - transactionID: String, + transactionId: String, keyAgreementProtocols: List, hashes: List, messageAuthenticationCodes: List, @@ -292,14 +292,14 @@ internal class VerificationTransportRoomMessage( VERIFICATION_METHOD_SAS, RelationDefaultContent( type = RelationType.REFERENCE, - eventId = transactionID + eventId = transactionId ), null ) } override fun createStartForQrCode(fromDevice: String, - transactionID: String, + transactionId: String, sharedSecret: String): VerificationInfoStart { return MessageVerificationStartContent( fromDevice, @@ -310,7 +310,7 @@ internal class VerificationTransportRoomMessage( VERIFICATION_METHOD_RECIPROCATE, RelationDefaultContent( type = RelationType.REFERENCE, - eventId = transactionID + eventId = transactionId ), sharedSecret ) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransportToDevice.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransportToDevice.kt index c178e53c4fa..5e4db4f934d 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransportToDevice.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/VerificationTransportToDevice.kt @@ -55,7 +55,7 @@ internal class VerificationTransportToDevice( Timber.d("## SAS sending verification request with supported methods: $supportedMethods") val contentMap = MXUsersDevicesMap() val validKeyReq = ValidVerificationInfoRequest( - transactionID = localID, + transactionId = localID, fromDevice = myDeviceId ?: "", methods = supportedMethods, timestamp = System.currentTimeMillis() @@ -64,7 +64,7 @@ internal class VerificationTransportToDevice( fromDevice = validKeyReq.fromDevice, methods = validKeyReq.methods, timestamp = validKeyReq.timestamp, - transactionId = validKeyReq.transactionID + transactionId = validKeyReq.transactionId ) toDevices?.forEach { contentMap.setObject(otherUserId, it, keyReq) @@ -204,7 +204,7 @@ internal class VerificationTransportToDevice( override fun createMac(tid: String, mac: Map, keys: String) = KeyVerificationMac.create(tid, mac, keys) override fun createStartForSas(fromDevice: String, - transactionID: String, + transactionId: String, keyAgreementProtocols: List, hashes: List, messageAuthenticationCodes: List, @@ -212,7 +212,7 @@ internal class VerificationTransportToDevice( return KeyVerificationStart( fromDevice, VERIFICATION_METHOD_SAS, - transactionID, + transactionId, keyAgreementProtocols, hashes, messageAuthenticationCodes, @@ -221,12 +221,12 @@ internal class VerificationTransportToDevice( } override fun createStartForQrCode(fromDevice: String, - transactionID: String, + transactionId: String, sharedSecret: String): VerificationInfoStart { return KeyVerificationStart( fromDevice, VERIFICATION_METHOD_RECIPROCATE, - transactionID, + transactionId, null, null, null, diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt index 51de36291d0..1f806d27ce7 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/send/LocalEchoEventFactory.kt @@ -71,7 +71,7 @@ import javax.inject.Inject * (the transaction ID), this id is used when receiving an event from a sync to check if this event * is matching an existing local echo. * - * The transactionID is used as loc + * The transactionId is used as loc */ internal class LocalEchoEventFactory @Inject constructor( @UserId private val userId: String,