From 36c52d24a74405c85af4dab71b11b075b08d638f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 5 Mar 2020 11:24:35 +0100 Subject: [PATCH] Move method to interface step 3 --- .../crypto/verification/VerificationInfoStart.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 5bbb069e94..bd4fd52980 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 @@ -76,13 +76,17 @@ internal interface VerificationInfoStart : VerificationInfo { } private fun isValidSas(): Boolean { + val myHashes = hashes + val myMessageAuthenticationCodes = messageAuthenticationCodes + val myShortAuthenticationStrings = shortAuthenticationStrings + if (keyAgreementProtocols.isNullOrEmpty() - || hashes.isNullOrEmpty() - || !hashes.contains("sha256") || messageAuthenticationCodes.isNullOrEmpty() - || (!messageAuthenticationCodes.contains(SASDefaultVerificationTransaction.SAS_MAC_SHA256) - && !messageAuthenticationCodes.contains(SASDefaultVerificationTransaction.SAS_MAC_SHA256_LONGKDF)) - || shortAuthenticationStrings.isNullOrEmpty() - || !shortAuthenticationStrings.contains(SasMode.DECIMAL)) { + || myHashes.isNullOrEmpty() + || !myHashes.contains("sha256") || myMessageAuthenticationCodes.isNullOrEmpty() + || (!myMessageAuthenticationCodes.contains(SASDefaultVerificationTransaction.SAS_MAC_SHA256) + && !myMessageAuthenticationCodes.contains(SASDefaultVerificationTransaction.SAS_MAC_SHA256_LONGKDF)) + || myShortAuthenticationStrings.isNullOrEmpty() + || !myShortAuthenticationStrings.contains(SasMode.DECIMAL)) { return false }