Rename to respect naming convention

This commit is contained in:
Benoit Marty 2020-03-06 13:40:35 +01:00
parent 4504308f25
commit e420070066
27 changed files with 30 additions and 31 deletions

View file

@ -278,7 +278,7 @@ class SASTest : InstrumentedTest {
val startMessage = KeyVerificationStart(
fromDevice = bobSession.cryptoService().getMyDevice().deviceId,
method = VerificationMethod.SAS.toValue(),
transactionID = tid,
transactionId = tid,
keyAgreementProtocols = protocols,
hashes = hashes,
messageAuthenticationCodes = mac,

View file

@ -33,7 +33,7 @@ internal data class MessageVerificationAcceptContent(
@Json(name = "commitment") override var commitment: String? = null
) : VerificationInfoAccept {
override val transactionID: String?
override val transactionId: String?
get() = relatesTo?.eventId
override fun toEventContent() = toContent()

View file

@ -30,7 +30,7 @@ data class MessageVerificationCancelContent(
@Json(name = "m.relates_to") val relatesTo: RelationDefaultContent?
) : VerificationInfoCancel {
override val transactionID: String?
override val transactionId: String?
get() = relatesTo?.eventId
override fun toEventContent() = toContent()

View file

@ -27,13 +27,13 @@ internal data class MessageVerificationDoneContent(
@Json(name = "m.relates_to") val relatesTo: RelationDefaultContent?
) : VerificationInfo<ValidVerificationDone> {
override val transactionID: String?
override val transactionId: String?
get() = relatesTo?.eventId
override fun toEventContent(): Content? = toContent()
override fun asValidObject(): ValidVerificationDone? {
val validTransactionId = transactionID?.takeIf { it.isNotEmpty() } ?: return null
val validTransactionId = transactionId?.takeIf { it.isNotEmpty() } ?: return null
return ValidVerificationDone(
validTransactionId

View file

@ -32,7 +32,7 @@ internal data class MessageVerificationKeyContent(
@Json(name = "m.relates_to") val relatesTo: RelationDefaultContent?
) : VerificationInfoKey {
override val transactionID: String?
override val transactionId: String?
get() = relatesTo?.eventId
override fun toEventContent() = toContent()

View file

@ -30,7 +30,7 @@ internal data class MessageVerificationMacContent(
@Json(name = "m.relates_to") val relatesTo: RelationDefaultContent?
) : VerificationInfoMac {
override val transactionID: String?
override val transactionId: String?
get() = relatesTo?.eventId
override fun toEventContent() = toContent()

View file

@ -30,7 +30,7 @@ internal data class MessageVerificationReadyContent(
@Json(name = "m.relates_to") val relatesTo: RelationDefaultContent?
) : VerificationInfoReady {
override val transactionID: String?
override val transactionId: String?
get() = relatesTo?.eventId
override fun toEventContent() = toContent()

View file

@ -35,7 +35,7 @@ data class MessageVerificationRequestContent(
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null,
@Json(name = "m.new_content") override val newContent: Content? = null,
// Not parsed, but set after, using the eventId
override val transactionID: String? = null
override val transactionId: String? = null
) : MessageContent, VerificationInfoRequest {
override fun toEventContent() = toContent()

View file

@ -38,7 +38,7 @@ internal data class MessageVerificationStartContent(
return JsonCanonicalizer.getCanonicalJson(MessageVerificationStartContent::class.java, this)
}
override val transactionID: String?
override val transactionId: String?
get() = relatesTo?.eventId
override fun toEventContent() = toContent()

View file

@ -25,14 +25,13 @@ import im.vector.matrix.android.internal.crypto.verification.VerificationInfoAcc
*/
@JsonClass(generateAdapter = true)
internal data class KeyVerificationAccept(
/**
* string to identify the transaction.
* This string must be unique for the pair of users performing verification for the duration that the transaction is valid.
* Alices device should record this ID and use it in future messages in this transaction.
*/
@Json(name = "transaction_id")
override val transactionID: String? = null,
override val transactionId: String? = null,
/**
* The key agreement protocol that Bobs device has selected to use, out of the list proposed by Alices device
@ -76,7 +75,7 @@ internal data class KeyVerificationAccept(
messageAuthenticationCode: String,
shortAuthenticationStrings: List<String>): VerificationInfoAccept {
return KeyVerificationAccept(
transactionID = tid,
transactionId = tid,
keyAgreementProtocol = keyAgreementProtocol,
hash = hash,
commitment = commitment,

View file

@ -29,7 +29,7 @@ internal data class KeyVerificationCancel(
* the transaction ID of the verification to cancel
*/
@Json(name = "transaction_id")
override val transactionID: String? = null,
override val transactionId: String? = null,
/**
* machine-readable reason for cancelling, see #CancelCode

View file

@ -24,7 +24,7 @@ import im.vector.matrix.android.internal.crypto.verification.VerificationInfoDon
*/
@JsonClass(generateAdapter = true)
internal data class KeyVerificationDone(
@Json(name = "transaction_id") override val transactionID: String? = null
@Json(name = "transaction_id") override val transactionId: String? = null
) : SendToDeviceObject, VerificationInfoDone {
override fun toSendToDeviceObject() = this

View file

@ -28,7 +28,7 @@ internal data class KeyVerificationKey(
/**
* the ID of the transaction that the message is part of
*/
@Json(name = "transaction_id") override val transactionID: String? = null,
@Json(name = "transaction_id") override val transactionId: String? = null,
/**
* The devices ephemeral public key, as an unpadded base64 string

View file

@ -25,7 +25,7 @@ import im.vector.matrix.android.internal.crypto.verification.VerificationInfoMac
*/
@JsonClass(generateAdapter = true)
internal data class KeyVerificationMac(
@Json(name = "transaction_id") override val transactionID: String? = null,
@Json(name = "transaction_id") override val transactionId: String? = null,
@Json(name = "mac") override val mac: Map<String, String>? = null,
@Json(name = "keys") override val keys: String? = null

View file

@ -26,7 +26,7 @@ import im.vector.matrix.android.internal.crypto.verification.VerificationInfoRea
internal data class KeyVerificationReady(
@Json(name = "from_device") override val fromDevice: String?,
@Json(name = "methods") override val methods: List<String>?,
@Json(name = "transaction_id") override val transactionID: String? = null
@Json(name = "transaction_id") override val transactionId: String? = null
) : SendToDeviceObject, VerificationInfoReady {
override fun toSendToDeviceObject() = this

View file

@ -27,7 +27,7 @@ internal data class KeyVerificationRequest(
@Json(name = "from_device") override val fromDevice: String?,
@Json(name = "methods") override val methods: List<String>,
@Json(name = "timestamp") override val timestamp: Long?,
@Json(name = "transaction_id") override val transactionID: String? = null
@Json(name = "transaction_id") override val transactionId: String? = null
) : SendToDeviceObject, VerificationInfoRequest {
override fun toSendToDeviceObject() = this

View file

@ -27,7 +27,7 @@ import im.vector.matrix.android.internal.util.JsonCanonicalizer
internal data class KeyVerificationStart(
@Json(name = "from_device") override val fromDevice: String? = null,
@Json(name = "method") override val method: String? = null,
@Json(name = "transaction_id") override val transactionID: String? = null,
@Json(name = "transaction_id") override val transactionId: String? = null,
@Json(name = "key_agreement_protocols") override val keyAgreementProtocols: List<String>? = null,
@Json(name = "hashes") override val hashes: List<String>? = null,
@Json(name = "message_authentication_codes") override val messageAuthenticationCodes: List<String>? = null,

View file

@ -29,5 +29,5 @@ interface VerificationInfo<ValidObjectType> {
* This string must be unique for the pair of users performing verification for the duration that the transaction is valid.
* Alices device should record this ID and use it in future messages in this transaction.
*/
val transactionID: String?
val transactionId: String?
}

View file

@ -43,7 +43,7 @@ internal interface VerificationInfoAccept : VerificationInfo<ValidVerificationIn
var commitment: String?
override fun asValidObject(): ValidVerificationInfoAccept? {
val validTransactionId = transactionID?.takeIf { it.isNotEmpty() } ?: return null
val validTransactionId = transactionId?.takeIf { it.isNotEmpty() } ?: return null
val validKeyAgreementProtocol = keyAgreementProtocol?.takeIf { it.isNotEmpty() } ?: return null
val validHash = hash?.takeIf { it.isNotEmpty() } ?: return null
val validMessageAuthenticationCode = messageAuthenticationCode?.takeIf { it.isNotEmpty() } ?: return null

View file

@ -27,7 +27,7 @@ internal interface VerificationInfoCancel : VerificationInfo<ValidVerificationIn
val reason: String?
override fun asValidObject(): ValidVerificationInfoCancel? {
val validTransactionId = transactionID?.takeIf { it.isNotEmpty() } ?: return null
val validTransactionId = transactionId?.takeIf { it.isNotEmpty() } ?: return null
val validCode = code?.takeIf { it.isNotEmpty() } ?: return null
return ValidVerificationInfoCancel(

View file

@ -18,7 +18,7 @@ package im.vector.matrix.android.internal.crypto.verification
internal interface VerificationInfoDone : VerificationInfo<ValidVerificationInfoDone> {
override fun asValidObject(): ValidVerificationInfoDone? {
if (transactionID.isNullOrBlank()) {
if (transactionId.isNullOrEmpty()) {
return null
}
return ValidVerificationInfoDone

View file

@ -25,7 +25,7 @@ internal interface VerificationInfoKey : VerificationInfo<ValidVerificationInfoK
val key: String?
override fun asValidObject(): ValidVerificationInfoKey? {
val validTransactionId = transactionID?.takeIf { it.isNotEmpty() } ?: return null
val validTransactionId = transactionId?.takeIf { it.isNotEmpty() } ?: return null
val validKey = key?.takeIf { it.isNotEmpty() } ?: return null
return ValidVerificationInfoKey(

View file

@ -30,7 +30,7 @@ internal interface VerificationInfoMac : VerificationInfo<ValidVerificationInfoM
val keys: String?
override fun asValidObject(): ValidVerificationInfoMac? {
val validTransactionId = transactionID?.takeIf { it.isNotEmpty() } ?: return null
val validTransactionId = transactionId?.takeIf { it.isNotEmpty() } ?: return null
val validMac = mac?.takeIf { it.isNotEmpty() } ?: return null
val validKeys = keys?.takeIf { it.isNotEmpty() } ?: return null

View file

@ -37,7 +37,7 @@ internal interface VerificationInfoReady : VerificationInfo<ValidVerificationInf
val methods: List<String>?
override fun asValidObject(): ValidVerificationInfoReady? {
val validTransactionId = transactionID?.takeIf { it.isNotEmpty() } ?: return null
val validTransactionId = transactionId?.takeIf { it.isNotEmpty() } ?: return null
val validFromDevice = fromDevice?.takeIf { it.isNotEmpty() } ?: return null
val validMethods = methods?.takeIf { it.isNotEmpty() } ?: return null

View file

@ -38,7 +38,7 @@ internal interface VerificationInfoRequest : VerificationInfo<ValidVerificationI
override fun asValidObject(): ValidVerificationInfoRequest? {
// FIXME No check on Timestamp?
val validTransactionId = transactionID?.takeIf { it.isNotEmpty() } ?: return null
val validTransactionId = transactionId?.takeIf { it.isNotEmpty() } ?: return null
val validFromDevice = fromDevice?.takeIf { it.isNotEmpty() } ?: return null
val validMethods = methods?.takeIf { it.isNotEmpty() } ?: return null

View file

@ -64,7 +64,7 @@ internal interface VerificationInfoStart : VerificationInfo<ValidVerificationInf
fun toCanonicalJson(): String
override fun asValidObject(): ValidVerificationInfoStart? {
val validTransactionId = transactionID?.takeIf { it.isNotEmpty() } ?: return null
val validTransactionId = transactionId?.takeIf { it.isNotEmpty() } ?: return null
val validFromDevice = fromDevice?.takeIf { it.isNotEmpty() } ?: return null
return when (method) {

View file

@ -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)
@ -236,7 +236,7 @@ internal class VerificationTransportToDevice(
override fun createReady(tid: String, fromDevice: String, methods: List<String>): VerificationInfoReady {
return KeyVerificationReady(
transactionID = tid,
transactionId = tid,
fromDevice = fromDevice,
methods = methods
)