From 0aaba26f17ad715d00a972cf538df429ff466c1d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 27 Jan 2020 14:50:04 +0100 Subject: [PATCH] Rename classes --- .../internal/crypto/verification/SASTest.kt | 14 +++++------ .../api/session/crypto/sas/CancelCode.kt | 2 ++ ... => OutgoingSasVerificationTransaction.kt} | 2 +- ...comingSASDefaultVerificationTransaction.kt | 2 +- ...goingSASDefaultVerificationTransaction.kt} | 24 +++++++++---------- .../DefaultVerificationService.kt | 4 ++-- .../SASDefaultVerificationTransaction.kt | 4 ++-- 7 files changed, 27 insertions(+), 25 deletions(-) rename matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/{OutgoingSasVerificationRequest.kt => OutgoingSasVerificationTransaction.kt} (92%) rename matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/{DefaultOutgoingSASDefaultVerificationRequest.kt => DefaultOutgoingSASDefaultVerificationTransaction.kt} (94%) diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/verification/SASTest.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/verification/SASTest.kt index 178eca09b2..06310e7566 100644 --- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/verification/SASTest.kt +++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/verification/SASTest.kt @@ -417,12 +417,12 @@ class SASTest : InstrumentedTest { override fun transactionCreated(tx: VerificationTransaction) {} override fun transactionUpdated(tx: VerificationTransaction) { - val uxState = (tx as OutgoingSasVerificationRequest).uxState + val uxState = (tx as OutgoingSasVerificationTransaction).uxState when (uxState) { - OutgoingSasVerificationRequest.UxState.SHOW_SAS -> { + OutgoingSasVerificationTransaction.UxState.SHOW_SAS -> { aliceSASLatch.countDown() } - else -> Unit + else -> Unit } } @@ -481,15 +481,15 @@ class SASTest : InstrumentedTest { override fun transactionCreated(tx: VerificationTransaction) {} override fun transactionUpdated(tx: VerificationTransaction) { - val uxState = (tx as OutgoingSasVerificationRequest).uxState + val uxState = (tx as OutgoingSasVerificationTransaction).uxState when (uxState) { - OutgoingSasVerificationRequest.UxState.SHOW_SAS -> { + OutgoingSasVerificationTransaction.UxState.SHOW_SAS -> { tx.userHasVerifiedShortCode() } - OutgoingSasVerificationRequest.UxState.VERIFIED -> { + OutgoingSasVerificationTransaction.UxState.VERIFIED -> { aliceSASLatch.countDown() } - else -> Unit + else -> Unit } } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/CancelCode.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/CancelCode.kt index 92a69bcad6..149d099b66 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/CancelCode.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/CancelCode.kt @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +// TODO Rename package package im.vector.matrix.android.api.session.crypto.sas enum class CancelCode(val value: String, val humanReadable: String) { diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationRequest.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationTransaction.kt similarity index 92% rename from matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationRequest.kt rename to matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationTransaction.kt index 587dac1f62..7ab386295a 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationRequest.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationTransaction.kt @@ -16,7 +16,7 @@ package im.vector.matrix.android.api.session.crypto.sas -interface OutgoingSasVerificationRequest : SasVerificationTransaction { +interface OutgoingSasVerificationTransaction : SasVerificationTransaction { val uxState: UxState enum class UxState { diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultIncomingSASDefaultVerificationTransaction.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultIncomingSASDefaultVerificationTransaction.kt index 863a68996e..13839a0499 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultIncomingSASDefaultVerificationTransaction.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultIncomingSASDefaultVerificationTransaction.kt @@ -47,7 +47,7 @@ internal class DefaultIncomingSASDefaultVerificationTransaction( transactionId, otherUserID, null, - true), + isIncoming = true), IncomingSasVerificationTransaction { override val uxState: IncomingSasVerificationTransaction.UxState diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationRequest.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationTransaction.kt similarity index 94% rename from matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationRequest.kt rename to matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationTransaction.kt index a2f9ae8219..3e693f53ad 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationRequest.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/DefaultOutgoingSASDefaultVerificationTransaction.kt @@ -17,14 +17,14 @@ package im.vector.matrix.android.internal.crypto.verification import im.vector.matrix.android.api.session.crypto.crosssigning.CrossSigningService import im.vector.matrix.android.api.session.crypto.sas.CancelCode -import im.vector.matrix.android.api.session.crypto.sas.OutgoingSasVerificationRequest +import im.vector.matrix.android.api.session.crypto.sas.OutgoingSasVerificationTransaction import im.vector.matrix.android.api.session.crypto.sas.VerificationTxState import im.vector.matrix.android.api.session.events.model.EventType import im.vector.matrix.android.internal.crypto.actions.SetDeviceVerificationAction import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore import timber.log.Timber -internal class DefaultOutgoingSASDefaultVerificationRequest( +internal class DefaultOutgoingSASDefaultVerificationTransaction( setDeviceVerificationAction: SetDeviceVerificationAction, userId: String, deviceId: String?, @@ -45,27 +45,27 @@ internal class DefaultOutgoingSASDefaultVerificationRequest( otherUserId, otherDeviceId, isIncoming = false), - OutgoingSasVerificationRequest { + OutgoingSasVerificationTransaction { - override val uxState: OutgoingSasVerificationRequest.UxState + override val uxState: OutgoingSasVerificationTransaction.UxState get() { return when (state) { - VerificationTxState.None -> OutgoingSasVerificationRequest.UxState.WAIT_FOR_START + VerificationTxState.None -> OutgoingSasVerificationTransaction.UxState.WAIT_FOR_START VerificationTxState.SendingStart, VerificationTxState.Started, VerificationTxState.OnAccepted, VerificationTxState.SendingKey, VerificationTxState.KeySent, - VerificationTxState.OnKeyReceived -> OutgoingSasVerificationRequest.UxState.WAIT_FOR_KEY_AGREEMENT - VerificationTxState.ShortCodeReady -> OutgoingSasVerificationRequest.UxState.SHOW_SAS + VerificationTxState.OnKeyReceived -> OutgoingSasVerificationTransaction.UxState.WAIT_FOR_KEY_AGREEMENT + VerificationTxState.ShortCodeReady -> OutgoingSasVerificationTransaction.UxState.SHOW_SAS VerificationTxState.ShortCodeAccepted, VerificationTxState.SendingMac, VerificationTxState.MacSent, - VerificationTxState.Verifying -> OutgoingSasVerificationRequest.UxState.WAIT_FOR_VERIFICATION - VerificationTxState.Verified -> OutgoingSasVerificationRequest.UxState.VERIFIED - VerificationTxState.OnCancelled -> OutgoingSasVerificationRequest.UxState.CANCELLED_BY_ME - VerificationTxState.Cancelled -> OutgoingSasVerificationRequest.UxState.CANCELLED_BY_OTHER - else -> OutgoingSasVerificationRequest.UxState.UNKNOWN + VerificationTxState.Verifying -> OutgoingSasVerificationTransaction.UxState.WAIT_FOR_VERIFICATION + VerificationTxState.Verified -> OutgoingSasVerificationTransaction.UxState.VERIFIED + VerificationTxState.OnCancelled -> OutgoingSasVerificationTransaction.UxState.CANCELLED_BY_ME + VerificationTxState.Cancelled -> OutgoingSasVerificationTransaction.UxState.CANCELLED_BY_OTHER + else -> OutgoingSasVerificationTransaction.UxState.UNKNOWN } } 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 2f28e64ca8..1bf35b2108 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 @@ -782,7 +782,7 @@ internal class DefaultVerificationService @Inject constructor( val txID = createUniqueIDForTransaction(otherUserId, otherDeviceID) // should check if already one (and cancel it) if (method == VerificationMethod.SAS) { - val tx = DefaultOutgoingSASDefaultVerificationRequest( + val tx = DefaultOutgoingSASDefaultVerificationTransaction( setDeviceVerificationAction, userId, deviceId, @@ -896,7 +896,7 @@ internal class DefaultVerificationService @Inject constructor( otherDeviceId: String, callback: MatrixCallback?): String? { if (method == VerificationMethod.SAS) { - val tx = DefaultOutgoingSASDefaultVerificationRequest( + val tx = DefaultOutgoingSASDefaultVerificationTransaction( setDeviceVerificationAction, userId, deviceId, diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/SASDefaultVerificationTransaction.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/SASDefaultVerificationTransaction.kt index a8f13d92cc..d53703f73a 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/SASDefaultVerificationTransaction.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/verification/SASDefaultVerificationTransaction.kt @@ -47,9 +47,9 @@ internal abstract class SASDefaultVerificationTransaction( private val deviceFingerprint: String, transactionId: String, otherUserId: String, - otherDevice: String?, + otherDeviceId: String?, isIncoming: Boolean -) : DefaultVerificationTransaction(transactionId, otherUserId, otherDevice, isIncoming), SasVerificationTransaction { +) : DefaultVerificationTransaction(transactionId, otherUserId, otherDeviceId, isIncoming), SasVerificationTransaction { companion object { const val SAS_MAC_SHA256_LONGKDF = "hmac-sha256"