Skip to content

Commit

Permalink
Code review fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Onuray Sahin committed Sep 7, 2021
1 parent 77a0ec1 commit e368a75
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,14 @@ internal class DefaultCryptoService @Inject constructor(
deviceListManager.refreshOutdatedDeviceLists()
// The presence of device_unused_fallback_key_types indicates that the server supports fallback keys.
// If there's no unused signed_curve25519 fallback key we need a new one.
val shouldGenerateFallbackKey = !syncResponse.deviceUnusedFallbackKeyTypes?.contains(KEY_SIGNED_CURVE_25519_TYPE).orTrue()
val shouldGenerateFallbackKey = if (syncResponse.deviceUnusedFallbackKeyTypes != null) {
// Generate a fallback key only if the server does not already have an unused fallback key.
!syncResponse.deviceUnusedFallbackKeyTypes.contains(KEY_SIGNED_CURVE_25519_TYPE)
} else {
// Server does not support fallbackKey
false
}

oneTimeKeysUploader.maybeUploadOneTimeKeys(shouldGenerateFallbackKey)
incomingGossipingRequestManager.processReceivedGossipingRequests()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ internal class MXOlmDevice @Inject constructor(
store.getOlmAccount().generateFallbackKey()
store.saveOlmAccount()
} catch (e: Exception) {
Timber.e("## getFallbackKey() : failed")
Timber.e("## generateFallbackKey() : failed")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ 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, fallbackJson)
val uploadParams = UploadKeysTask.Params(
deviceKeys = null,
oneTimeKeys = oneTimeJson,
fallbackKeys = if (fallbackJson.isNotEmpty()) fallbackJson else null
)
return uploadKeysTask.execute(uploadParams)
}

Expand Down

0 comments on commit e368a75

Please sign in to comment.