diff --git a/CHANGES.md b/CHANGES.md index 63dad2ade6..df550511e2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -32,6 +32,7 @@ Other changes: - Fix self-assignment of callback in `DefaultRoomPushRuleService#setRoomNotificationState` (#1520) - Random housekeeping clean-ups indicated by Lint (#1520, #1541) - Keys Backup API now use the unstable prefix (#1503) + - Remove deviceId from /keys/upload/{deviceId} as not spec-compliant (#1502) Changes in RiotX 0.22.0 (2020-06-15) =================================================== diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/DefaultCryptoService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/DefaultCryptoService.kt index 05f29f1660..a588cdc66e 100755 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/DefaultCryptoService.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/DefaultCryptoService.kt @@ -933,9 +933,7 @@ internal class DefaultCryptoService @Inject constructor( signatures = objectSigner.signObject(canonicalJson) ) - // For now, we set the device id explicitly, as we may not be using the - // same one as used in login. - val uploadDeviceKeysParams = UploadKeysTask.Params(rest, null, getMyDevice().deviceId) + val uploadDeviceKeysParams = UploadKeysTask.Params(rest, null) return uploadKeysTask.execute(uploadDeviceKeysParams) } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysUploader.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysUploader.kt index 89965e7da9..0752e646f2 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysUploader.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/OneTimeKeysUploader.kt @@ -16,7 +16,6 @@ package im.vector.matrix.android.internal.crypto -import im.vector.matrix.android.api.auth.data.Credentials import im.vector.matrix.android.internal.crypto.model.MXKey import im.vector.matrix.android.internal.crypto.model.rest.KeysUploadResponse import im.vector.matrix.android.internal.crypto.tasks.UploadKeysTask @@ -30,7 +29,6 @@ import kotlin.math.min @SessionScope internal class OneTimeKeysUploader @Inject constructor( - private val credentials: Credentials, private val olmDevice: MXOlmDevice, private val objectSigner: ObjectSigner, private val uploadKeysTask: UploadKeysTask @@ -153,7 +151,7 @@ internal class OneTimeKeysUploader @Inject constructor( // For now, we set the device id explicitly, as we may not be using the // same one as used in login. - val uploadParams = UploadKeysTask.Params(null, oneTimeJson, credentials.deviceId!!) + val uploadParams = UploadKeysTask.Params(null, oneTimeJson) return uploadKeysTask.execute(uploadParams) } diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/api/CryptoApi.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/api/CryptoApi.kt index 93dae588aa..d3ba501d03 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/api/CryptoApi.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/api/CryptoApi.kt @@ -60,21 +60,11 @@ internal interface CryptoApi { * Upload device and/or one-time keys. * Doc: https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-keys-upload * - * @param params the params. + * @param body the keys to be sent. */ @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "keys/upload") fun uploadKeys(@Body body: KeysUploadBody): Call - /** - * Upload device and/or one-time keys. - * Doc: not documented - * - * @param deviceId the deviceId - * @param params the params. - */ - @POST(NetworkConstants.URI_API_PREFIX_PATH_R0 + "keys/upload/{deviceId}") - fun uploadKeys(@Path("deviceId") deviceId: String, @Body body: KeysUploadBody): Call - /** * Download device keys. * Doc: https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-keys-query diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/tasks/UploadKeysTask.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/tasks/UploadKeysTask.kt index 6574132c7f..8f14e08676 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/tasks/UploadKeysTask.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/crypto/tasks/UploadKeysTask.kt @@ -23,7 +23,6 @@ import im.vector.matrix.android.internal.crypto.model.rest.KeysUploadResponse import im.vector.matrix.android.internal.crypto.model.rest.RestDeviceInfo import im.vector.matrix.android.internal.network.executeRequest import im.vector.matrix.android.internal.task.Task -import im.vector.matrix.android.internal.util.convertToUTF8 import org.greenrobot.eventbus.EventBus import timber.log.Timber import javax.inject.Inject @@ -33,9 +32,8 @@ internal interface UploadKeysTask : Task $body") return executeRequest(eventBus) { - apiCall = if (encodedDeviceId.isBlank()) { - cryptoApi.uploadKeys(body) - } else { - cryptoApi.uploadKeys(encodedDeviceId, body) - } + apiCall = cryptoApi.uploadKeys(body) } } }