From 25f45da1958405bd063e5c7e2474417f87dbcf9a Mon Sep 17 00:00:00 2001 From: Tobias Preuss Date: Tue, 23 Jun 2020 18:25:37 +0200 Subject: [PATCH] Use indexing operator. --- .../matrix/android/common/CryptoTestHelper.kt | 14 +++++++------- .../android/internal/crypto/ssss/QuadSTests.kt | 2 +- .../SASDefaultVerificationTransaction.kt | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/common/CryptoTestHelper.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/common/CryptoTestHelper.kt index 35ad8ff4e1..4eda7c60c8 100644 --- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/common/CryptoTestHelper.kt +++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/common/CryptoTestHelper.kt @@ -241,14 +241,14 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) { val eventWireContent = event.content.toContent() assertNotNull(eventWireContent) - assertNull(eventWireContent.get("body")) - assertEquals(MXCRYPTO_ALGORITHM_MEGOLM, eventWireContent.get("algorithm")) + assertNull(eventWireContent["body"]) + assertEquals(MXCRYPTO_ALGORITHM_MEGOLM, eventWireContent["algorithm"]) - assertNotNull(eventWireContent.get("ciphertext")) - assertNotNull(eventWireContent.get("session_id")) - assertNotNull(eventWireContent.get("sender_key")) + assertNotNull(eventWireContent["ciphertext"]) + assertNotNull(eventWireContent["session_id"]) + assertNotNull(eventWireContent["sender_key"]) - assertEquals(senderSession.sessionParams.deviceId, eventWireContent.get("device_id")) + assertEquals(senderSession.sessionParams.deviceId, eventWireContent["device_id"]) assertNotNull(event.eventId) assertEquals(roomId, event.roomId) @@ -257,7 +257,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) { val eventContent = event.toContent() assertNotNull(eventContent) - assertEquals(clearMessage, eventContent.get("body")) + assertEquals(clearMessage, eventContent["body"]) assertEquals(senderSession.myUserId, event.senderId) } diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/ssss/QuadSTests.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/ssss/QuadSTests.kt index cbd175f53f..d93b151ded 100644 --- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/ssss/QuadSTests.kt +++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/ssss/QuadSTests.kt @@ -144,7 +144,7 @@ class QuadSTests : InstrumentedTest { val secretAccountData = assertAccountData(aliceSession, "secret.of.life") - val encryptedContent = secretAccountData.content.get("encrypted") as? Map<*, *> + val encryptedContent = secretAccountData.content["encrypted"] as? Map<*, *> assertNotNull("Element should be encrypted", encryptedContent) assertNotNull("Secret should be encrypted with default key", encryptedContent?.get(keyId)) 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 7048d790a0..db97ba1052 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 @@ -273,7 +273,7 @@ internal abstract class SASDefaultVerificationTransaction( if (keyIDNoPrefix == otherCrossSigningMasterKeyPublic) { // Check the signature val mac = macUsingAgreedMethod(otherCrossSigningMasterKeyPublic, baseInfo + it) - if (mac != theirMacSafe.mac.get(it)) { + if (mac != theirMacSafe.mac[it]) { // WRONG! Timber.e("## SAS Verification: mac mismatch for MasterKey with id $keyIDNoPrefix") cancel(CancelCode.MismatchedKeys)