mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 12:00:03 +03:00
cleaning
This commit is contained in:
parent
ce63332a2f
commit
36c5566b07
3 changed files with 34 additions and 8 deletions
|
@ -38,7 +38,7 @@ internal data class MessageVerificationStartContent(
|
|||
) : VerificationInfoStart {
|
||||
|
||||
override fun toCanonicalJson(): String? {
|
||||
return JsonCanonicalizer.getCanonicalJson(MessageVerificationStartContent::class.java, this)
|
||||
return JsonCanonicalizer.getCanonicalJson(MessageVerificationStartContent::class.java, this)
|
||||
}
|
||||
|
||||
override val transactionID: String?
|
||||
|
@ -46,9 +46,14 @@ internal data class MessageVerificationStartContent(
|
|||
|
||||
override fun isValid(): Boolean {
|
||||
if (
|
||||
(transactionID.isNullOrBlank() || fromDevice.isNullOrBlank() || method != KeyVerificationStart.VERIF_METHOD_SAS || keyAgreementProtocols.isNullOrEmpty() || hashes.isNullOrEmpty())
|
||||
(transactionID.isNullOrBlank()
|
||||
|| fromDevice.isNullOrBlank()
|
||||
|| method != KeyVerificationStart.VERIF_METHOD_SAS
|
||||
|| keyAgreementProtocols.isNullOrEmpty()
|
||||
|| hashes.isNullOrEmpty())
|
||||
|| !hashes.contains("sha256") || messageAuthenticationCodes.isNullOrEmpty()
|
||||
|| (!messageAuthenticationCodes.contains(SASVerificationTransaction.SAS_MAC_SHA256) && !messageAuthenticationCodes.contains(SASVerificationTransaction.SAS_MAC_SHA256_LONGKDF))
|
||||
|| (!messageAuthenticationCodes.contains(SASVerificationTransaction.SAS_MAC_SHA256)
|
||||
&& !messageAuthenticationCodes.contains(SASVerificationTransaction.SAS_MAC_SHA256_LONGKDF))
|
||||
|| shortAuthenticationStrings.isNullOrEmpty()
|
||||
|| !shortAuthenticationStrings.contains(SasMode.DECIMAL)) {
|
||||
Timber.e("## received invalid verification request")
|
||||
|
@ -57,5 +62,5 @@ internal data class MessageVerificationStartContent(
|
|||
return true
|
||||
}
|
||||
|
||||
override fun toEventContent() = this.toContent()
|
||||
override fun toEventContent() = this.toContent()
|
||||
}
|
||||
|
|
|
@ -41,7 +41,11 @@ internal class SasTransportRoomMessage(
|
|||
private val taskExecutor: TaskExecutor
|
||||
) : SasTransport {
|
||||
|
||||
override fun sendToOther(type: String, verificationInfo: VerificationInfo, nextState: SasVerificationTxState, onErrorReason: CancelCode, onDone: (() -> Unit)?) {
|
||||
override fun sendToOther(type: String,
|
||||
verificationInfo: VerificationInfo,
|
||||
nextState: SasVerificationTxState,
|
||||
onErrorReason: CancelCode,
|
||||
onDone: (() -> Unit)?) {
|
||||
Timber.d("## SAS sending msg type $type")
|
||||
Timber.v("## SAS sending msg info $verificationInfo")
|
||||
sendVerificationMessageTask.configureWith(
|
||||
|
@ -109,7 +113,14 @@ internal class SasTransportRoomMessage(
|
|||
commitment: String,
|
||||
messageAuthenticationCode: String,
|
||||
shortAuthenticationStrings: List<String>)
|
||||
: VerificationInfoAccept = MessageVerificationAcceptContent.create(tid, keyAgreementProtocol, hash, commitment, messageAuthenticationCode, shortAuthenticationStrings)
|
||||
: VerificationInfoAccept = MessageVerificationAcceptContent.create(
|
||||
tid,
|
||||
keyAgreementProtocol,
|
||||
hash,
|
||||
commitment,
|
||||
messageAuthenticationCode,
|
||||
shortAuthenticationStrings
|
||||
)
|
||||
|
||||
override fun createKey(tid: String, pubKey: String): VerificationInfoKey = MessageVerificationKeyContent.create(tid, pubKey)
|
||||
|
||||
|
|
|
@ -36,7 +36,11 @@ internal class SasTransportToDevice(
|
|||
private var taskExecutor: TaskExecutor
|
||||
) : SasTransport {
|
||||
|
||||
override fun sendToOther(type: String, verificationInfo: VerificationInfo, nextState: SasVerificationTxState, onErrorReason: CancelCode, onDone: (() -> Unit)?) {
|
||||
override fun sendToOther(type: String,
|
||||
verificationInfo: VerificationInfo,
|
||||
nextState: SasVerificationTxState,
|
||||
onErrorReason: CancelCode,
|
||||
onDone: (() -> Unit)?) {
|
||||
Timber.d("## SAS sending msg type $type")
|
||||
Timber.v("## SAS sending msg info $verificationInfo")
|
||||
val tx = tx ?: return
|
||||
|
@ -98,7 +102,13 @@ internal class SasTransportToDevice(
|
|||
commitment: String,
|
||||
messageAuthenticationCode: String,
|
||||
shortAuthenticationStrings: List<String>)
|
||||
: VerificationInfoAccept = KeyVerificationAccept.create(tid, keyAgreementProtocol, hash, commitment, messageAuthenticationCode, shortAuthenticationStrings)
|
||||
: VerificationInfoAccept = KeyVerificationAccept.create(
|
||||
tid,
|
||||
keyAgreementProtocol,
|
||||
hash,
|
||||
commitment,
|
||||
messageAuthenticationCode,
|
||||
shortAuthenticationStrings)
|
||||
|
||||
override fun createKey(tid: String, pubKey: String): VerificationInfoKey = KeyVerificationKey.create(tid, pubKey)
|
||||
|
||||
|
|
Loading…
Reference in a new issue