Use indexing operator.

This commit is contained in:
Tobias Preuss 2020-06-23 18:25:37 +02:00
parent 9d191a783d
commit 25f45da195
3 changed files with 9 additions and 9 deletions

View File

@ -241,14 +241,14 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
val eventWireContent = event.content.toContent() val eventWireContent = event.content.toContent()
assertNotNull(eventWireContent) assertNotNull(eventWireContent)
assertNull(eventWireContent.get("body")) assertNull(eventWireContent["body"])
assertEquals(MXCRYPTO_ALGORITHM_MEGOLM, eventWireContent.get("algorithm")) assertEquals(MXCRYPTO_ALGORITHM_MEGOLM, eventWireContent["algorithm"])
assertNotNull(eventWireContent.get("ciphertext")) assertNotNull(eventWireContent["ciphertext"])
assertNotNull(eventWireContent.get("session_id")) assertNotNull(eventWireContent["session_id"])
assertNotNull(eventWireContent.get("sender_key")) assertNotNull(eventWireContent["sender_key"])
assertEquals(senderSession.sessionParams.deviceId, eventWireContent.get("device_id")) assertEquals(senderSession.sessionParams.deviceId, eventWireContent["device_id"])
assertNotNull(event.eventId) assertNotNull(event.eventId)
assertEquals(roomId, event.roomId) assertEquals(roomId, event.roomId)
@ -257,7 +257,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
val eventContent = event.toContent() val eventContent = event.toContent()
assertNotNull(eventContent) assertNotNull(eventContent)
assertEquals(clearMessage, eventContent.get("body")) assertEquals(clearMessage, eventContent["body"])
assertEquals(senderSession.myUserId, event.senderId) assertEquals(senderSession.myUserId, event.senderId)
} }

View File

@ -144,7 +144,7 @@ class QuadSTests : InstrumentedTest {
val secretAccountData = assertAccountData(aliceSession, "secret.of.life") 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("Element should be encrypted", encryptedContent)
assertNotNull("Secret should be encrypted with default key", encryptedContent?.get(keyId)) assertNotNull("Secret should be encrypted with default key", encryptedContent?.get(keyId))

View File

@ -273,7 +273,7 @@ internal abstract class SASDefaultVerificationTransaction(
if (keyIDNoPrefix == otherCrossSigningMasterKeyPublic) { if (keyIDNoPrefix == otherCrossSigningMasterKeyPublic) {
// Check the signature // Check the signature
val mac = macUsingAgreedMethod(otherCrossSigningMasterKeyPublic, baseInfo + it) val mac = macUsingAgreedMethod(otherCrossSigningMasterKeyPublic, baseInfo + it)
if (mac != theirMacSafe.mac.get(it)) { if (mac != theirMacSafe.mac[it]) {
// WRONG! // WRONG!
Timber.e("## SAS Verification: mac mismatch for MasterKey with id $keyIDNoPrefix") Timber.e("## SAS Verification: mac mismatch for MasterKey with id $keyIDNoPrefix")
cancel(CancelCode.MismatchedKeys) cancel(CancelCode.MismatchedKeys)