From 0cfc9451cafd85b72d9ca0f603a482b6bd29c06a Mon Sep 17 00:00:00 2001 From: Valere Date: Tue, 25 Feb 2020 14:28:34 +0100 Subject: [PATCH] Cleaning --- .../crypto/crosssigning/CrossSigningService.kt | 3 +-- .../crosssigning/DefaultCrossSigningService.kt | 17 +++++++++++------ vector/src/main/res/values/strings_riotX.xml | 1 - 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/crosssigning/CrossSigningService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/crosssigning/CrossSigningService.kt index 89062e171a..ff4745ef46 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/crosssigning/CrossSigningService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/crosssigning/CrossSigningService.kt @@ -44,8 +44,7 @@ interface CrossSigningService { fun checkTrustFromPrivateKeys(masterKeyPrivateKey: String?, uskKeyPrivateKey: String?, - sskPrivateKey: String?, - callback: MatrixCallback? = null) : UserTrustResult + sskPrivateKey: String?) : UserTrustResult fun getUserCrossSigningKeys(otherUserId: String): MXCrossSigningInfo? diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/crosssigning/DefaultCrossSigningService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/crosssigning/DefaultCrossSigningService.kt index bad0280fee..a29f27ddd6 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/crosssigning/DefaultCrossSigningService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/crosssigning/DefaultCrossSigningService.kt @@ -227,16 +227,18 @@ internal class DefaultCrossSigningService @Inject constructor( val myDevice = myDeviceInfoHolder.get().myDevice val canonicalJson = JsonCanonicalizer.getCanonicalJson(Map::class.java, myDevice.signalableJSONDictionary()) val signedDevice = selfSigningPkOlm.sign(canonicalJson) - val updateSignatures = (myDevice.signatures?.toMutableMap() ?: HashMap()).also { - it[userId] = (it[userId] - ?: HashMap()) + mapOf("ed25519:$sskPublicKey" to signedDevice) - } + val updateSignatures = (myDevice.signatures?.toMutableMap() ?: HashMap()) + .also { + it[userId] = (it[userId] + ?: HashMap()) + mapOf("ed25519:$sskPublicKey" to signedDevice) + } myDevice.copy(signatures = updateSignatures).let { uploadSignatureQueryBuilder.withDeviceInfo(it) } // sign MSK with device key (migration) and upload signatures - olmDevice.signMessage(JsonCanonicalizer.getCanonicalJson(Map::class.java, mskCrossSigningKeyInfo.signalableJSONDictionary()))?.let { sign -> + val message = JsonCanonicalizer.getCanonicalJson(Map::class.java, mskCrossSigningKeyInfo.signalableJSONDictionary()) + olmDevice.signMessage(message)?.let { sign -> val mskUpdatedSignatures = (mskCrossSigningKeyInfo.signatures?.toMutableMap() ?: HashMap()).also { it[userId] = (it[userId] @@ -295,7 +297,10 @@ internal class DefaultCrossSigningService @Inject constructor( cryptoStore.clearOtherUserTrust() } - override fun checkTrustFromPrivateKeys(masterKeyPrivateKey: String?, uskKeyPrivateKey: String?, sskPrivateKey: String?, callback: MatrixCallback?): UserTrustResult { + override fun checkTrustFromPrivateKeys(masterKeyPrivateKey: String?, + uskKeyPrivateKey: String?, + sskPrivateKey: String? + ): UserTrustResult { val mxCrossSigningInfo = getMyCrossSigningKeys() ?: return UserTrustResult.CrossSigningNotConfigured(userId) var masterKeyIsTrusted = false diff --git a/vector/src/main/res/values/strings_riotX.xml b/vector/src/main/res/values/strings_riotX.xml index fc2a7beb26..4328355937 100644 --- a/vector/src/main/res/values/strings_riotX.xml +++ b/vector/src/main/res/values/strings_riotX.xml @@ -18,7 +18,6 @@ Selected Option Creates a simple poll - Can‘t access an existing session? Use your recovery key or passphrase