Rename classes

This commit is contained in:
Benoit Marty 2020-01-27 14:50:04 +01:00
parent fc04833157
commit 0aaba26f17
7 changed files with 27 additions and 25 deletions

View file

@ -417,9 +417,9 @@ class SASTest : InstrumentedTest {
override fun transactionCreated(tx: VerificationTransaction) {} override fun transactionCreated(tx: VerificationTransaction) {}
override fun transactionUpdated(tx: VerificationTransaction) { override fun transactionUpdated(tx: VerificationTransaction) {
val uxState = (tx as OutgoingSasVerificationRequest).uxState val uxState = (tx as OutgoingSasVerificationTransaction).uxState
when (uxState) { when (uxState) {
OutgoingSasVerificationRequest.UxState.SHOW_SAS -> { OutgoingSasVerificationTransaction.UxState.SHOW_SAS -> {
aliceSASLatch.countDown() aliceSASLatch.countDown()
} }
else -> Unit else -> Unit
@ -481,12 +481,12 @@ class SASTest : InstrumentedTest {
override fun transactionCreated(tx: VerificationTransaction) {} override fun transactionCreated(tx: VerificationTransaction) {}
override fun transactionUpdated(tx: VerificationTransaction) { override fun transactionUpdated(tx: VerificationTransaction) {
val uxState = (tx as OutgoingSasVerificationRequest).uxState val uxState = (tx as OutgoingSasVerificationTransaction).uxState
when (uxState) { when (uxState) {
OutgoingSasVerificationRequest.UxState.SHOW_SAS -> { OutgoingSasVerificationTransaction.UxState.SHOW_SAS -> {
tx.userHasVerifiedShortCode() tx.userHasVerifiedShortCode()
} }
OutgoingSasVerificationRequest.UxState.VERIFIED -> { OutgoingSasVerificationTransaction.UxState.VERIFIED -> {
aliceSASLatch.countDown() aliceSASLatch.countDown()
} }
else -> Unit else -> Unit

View file

@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
// TODO Rename package
package im.vector.matrix.android.api.session.crypto.sas package im.vector.matrix.android.api.session.crypto.sas
enum class CancelCode(val value: String, val humanReadable: String) { enum class CancelCode(val value: String, val humanReadable: String) {

View file

@ -16,7 +16,7 @@
package im.vector.matrix.android.api.session.crypto.sas package im.vector.matrix.android.api.session.crypto.sas
interface OutgoingSasVerificationRequest : SasVerificationTransaction { interface OutgoingSasVerificationTransaction : SasVerificationTransaction {
val uxState: UxState val uxState: UxState
enum class UxState { enum class UxState {

View file

@ -47,7 +47,7 @@ internal class DefaultIncomingSASDefaultVerificationTransaction(
transactionId, transactionId,
otherUserID, otherUserID,
null, null,
true), isIncoming = true),
IncomingSasVerificationTransaction { IncomingSasVerificationTransaction {
override val uxState: IncomingSasVerificationTransaction.UxState override val uxState: IncomingSasVerificationTransaction.UxState

View file

@ -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.crosssigning.CrossSigningService
import im.vector.matrix.android.api.session.crypto.sas.CancelCode 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.crypto.sas.VerificationTxState
import im.vector.matrix.android.api.session.events.model.EventType 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.actions.SetDeviceVerificationAction
import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore
import timber.log.Timber import timber.log.Timber
internal class DefaultOutgoingSASDefaultVerificationRequest( internal class DefaultOutgoingSASDefaultVerificationTransaction(
setDeviceVerificationAction: SetDeviceVerificationAction, setDeviceVerificationAction: SetDeviceVerificationAction,
userId: String, userId: String,
deviceId: String?, deviceId: String?,
@ -45,27 +45,27 @@ internal class DefaultOutgoingSASDefaultVerificationRequest(
otherUserId, otherUserId,
otherDeviceId, otherDeviceId,
isIncoming = false), isIncoming = false),
OutgoingSasVerificationRequest { OutgoingSasVerificationTransaction {
override val uxState: OutgoingSasVerificationRequest.UxState override val uxState: OutgoingSasVerificationTransaction.UxState
get() { get() {
return when (state) { return when (state) {
VerificationTxState.None -> OutgoingSasVerificationRequest.UxState.WAIT_FOR_START VerificationTxState.None -> OutgoingSasVerificationTransaction.UxState.WAIT_FOR_START
VerificationTxState.SendingStart, VerificationTxState.SendingStart,
VerificationTxState.Started, VerificationTxState.Started,
VerificationTxState.OnAccepted, VerificationTxState.OnAccepted,
VerificationTxState.SendingKey, VerificationTxState.SendingKey,
VerificationTxState.KeySent, VerificationTxState.KeySent,
VerificationTxState.OnKeyReceived -> OutgoingSasVerificationRequest.UxState.WAIT_FOR_KEY_AGREEMENT VerificationTxState.OnKeyReceived -> OutgoingSasVerificationTransaction.UxState.WAIT_FOR_KEY_AGREEMENT
VerificationTxState.ShortCodeReady -> OutgoingSasVerificationRequest.UxState.SHOW_SAS VerificationTxState.ShortCodeReady -> OutgoingSasVerificationTransaction.UxState.SHOW_SAS
VerificationTxState.ShortCodeAccepted, VerificationTxState.ShortCodeAccepted,
VerificationTxState.SendingMac, VerificationTxState.SendingMac,
VerificationTxState.MacSent, VerificationTxState.MacSent,
VerificationTxState.Verifying -> OutgoingSasVerificationRequest.UxState.WAIT_FOR_VERIFICATION VerificationTxState.Verifying -> OutgoingSasVerificationTransaction.UxState.WAIT_FOR_VERIFICATION
VerificationTxState.Verified -> OutgoingSasVerificationRequest.UxState.VERIFIED VerificationTxState.Verified -> OutgoingSasVerificationTransaction.UxState.VERIFIED
VerificationTxState.OnCancelled -> OutgoingSasVerificationRequest.UxState.CANCELLED_BY_ME VerificationTxState.OnCancelled -> OutgoingSasVerificationTransaction.UxState.CANCELLED_BY_ME
VerificationTxState.Cancelled -> OutgoingSasVerificationRequest.UxState.CANCELLED_BY_OTHER VerificationTxState.Cancelled -> OutgoingSasVerificationTransaction.UxState.CANCELLED_BY_OTHER
else -> OutgoingSasVerificationRequest.UxState.UNKNOWN else -> OutgoingSasVerificationTransaction.UxState.UNKNOWN
} }
} }

View file

@ -782,7 +782,7 @@ internal class DefaultVerificationService @Inject constructor(
val txID = createUniqueIDForTransaction(otherUserId, otherDeviceID) val txID = createUniqueIDForTransaction(otherUserId, otherDeviceID)
// should check if already one (and cancel it) // should check if already one (and cancel it)
if (method == VerificationMethod.SAS) { if (method == VerificationMethod.SAS) {
val tx = DefaultOutgoingSASDefaultVerificationRequest( val tx = DefaultOutgoingSASDefaultVerificationTransaction(
setDeviceVerificationAction, setDeviceVerificationAction,
userId, userId,
deviceId, deviceId,
@ -896,7 +896,7 @@ internal class DefaultVerificationService @Inject constructor(
otherDeviceId: String, otherDeviceId: String,
callback: MatrixCallback<String>?): String? { callback: MatrixCallback<String>?): String? {
if (method == VerificationMethod.SAS) { if (method == VerificationMethod.SAS) {
val tx = DefaultOutgoingSASDefaultVerificationRequest( val tx = DefaultOutgoingSASDefaultVerificationTransaction(
setDeviceVerificationAction, setDeviceVerificationAction,
userId, userId,
deviceId, deviceId,

View file

@ -47,9 +47,9 @@ internal abstract class SASDefaultVerificationTransaction(
private val deviceFingerprint: String, private val deviceFingerprint: String,
transactionId: String, transactionId: String,
otherUserId: String, otherUserId: String,
otherDevice: String?, otherDeviceId: String?,
isIncoming: Boolean isIncoming: Boolean
) : DefaultVerificationTransaction(transactionId, otherUserId, otherDevice, isIncoming), SasVerificationTransaction { ) : DefaultVerificationTransaction(transactionId, otherUserId, otherDeviceId, isIncoming), SasVerificationTransaction {
companion object { companion object {
const val SAS_MAC_SHA256_LONGKDF = "hmac-sha256" const val SAS_MAC_SHA256_LONGKDF = "hmac-sha256"