mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-22 14:38:15 +08:00
bump crypto sdk to 0.3.16
This commit is contained in:
parent
979324da84
commit
b61b2b6f16
@ -215,7 +215,7 @@ dependencies {
|
||||
|
||||
implementation libs.google.phonenumber
|
||||
|
||||
implementation("org.matrix.rustcomponents:crypto-android:0.3.15")
|
||||
implementation("org.matrix.rustcomponents:crypto-android:0.3.16")
|
||||
// api project(":library:rustCrypto")
|
||||
|
||||
testImplementation libs.tests.junit
|
||||
|
@ -240,7 +240,8 @@ interface CryptoService {
|
||||
toDevice: ToDeviceSyncResponse?,
|
||||
deviceChanges: DeviceListResponse?,
|
||||
keyCounts: DeviceOneTimeKeysCountSyncResponse?,
|
||||
deviceUnusedFallbackKeyTypes: List<String>?)
|
||||
deviceUnusedFallbackKeyTypes: List<String>?,
|
||||
nextBatch: String?)
|
||||
|
||||
suspend fun onLiveEvent(roomId: String, event: Event, isInitialSync: Boolean, cryptoStoreAggregator: CryptoStoreAggregator?)
|
||||
suspend fun onStateEvent(roomId: String, event: Event, cryptoStoreAggregator: CryptoStoreAggregator?) {}
|
||||
|
@ -19,7 +19,6 @@ package org.matrix.android.sdk.internal.crypto
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.asLiveData
|
||||
import com.squareup.moshi.Moshi
|
||||
import com.squareup.moshi.Types
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.channelFlow
|
||||
import kotlinx.coroutines.runBlocking
|
||||
@ -262,6 +261,7 @@ internal class OlmMachine @Inject constructor(
|
||||
deviceChanges: DeviceListResponse?,
|
||||
keyCounts: DeviceOneTimeKeysCountSyncResponse?,
|
||||
deviceUnusedFallbackKeyTypes: List<String>?,
|
||||
nextBatch: String?
|
||||
): ToDeviceSyncResponse {
|
||||
val response = withContext(coroutineDispatchers.io) {
|
||||
val counts: MutableMap<String, Int> = mutableMapOf()
|
||||
@ -281,18 +281,16 @@ internal class OlmMachine @Inject constructor(
|
||||
val events = adapter.toJson(toDevice ?: ToDeviceSyncResponse())
|
||||
|
||||
// field pass in the list of unused fallback keys here
|
||||
val receiveSyncChanges = inner.receiveSyncChanges(events, devices, counts, deviceUnusedFallbackKeyTypes)
|
||||
val receiveSyncChanges = inner.receiveSyncChanges(events, devices, counts, deviceUnusedFallbackKeyTypes, nextBatch ?: "")
|
||||
|
||||
val outAdapter = moshi.adapter<List<Event>>(
|
||||
Types.newParameterizedType(
|
||||
List::class.java,
|
||||
Event::class.java,
|
||||
String::class.java,
|
||||
Integer::class.java,
|
||||
Any::class.java,
|
||||
)
|
||||
)
|
||||
outAdapter.fromJson(receiveSyncChanges) ?: emptyList()
|
||||
val outAdapter = moshi.adapter(Event::class.java)
|
||||
|
||||
// we don't need to use `roomKeyInfos` as we are for now we are
|
||||
// checking the returned to devices to check for room keys.
|
||||
// XXX Anyhow there is now proper signaling we should soon stop parsing them manually
|
||||
receiveSyncChanges.toDeviceEvents.map {
|
||||
outAdapter.fromJson(it) ?: Event()
|
||||
}
|
||||
}
|
||||
|
||||
// We may get cross signing keys over a to-device event, update our listeners.
|
||||
|
@ -618,9 +618,10 @@ internal class RustCryptoService @Inject constructor(
|
||||
deviceChanges: DeviceListResponse?,
|
||||
keyCounts: DeviceOneTimeKeysCountSyncResponse?,
|
||||
deviceUnusedFallbackKeyTypes: List<String>?,
|
||||
nextBatch: String?,
|
||||
) {
|
||||
// Decrypt and handle our to-device events
|
||||
val toDeviceEvents = this.olmMachine.receiveSyncChanges(toDevice, deviceChanges, keyCounts, deviceUnusedFallbackKeyTypes)
|
||||
val toDeviceEvents = this.olmMachine.receiveSyncChanges(toDevice, deviceChanges, keyCounts, deviceUnusedFallbackKeyTypes, nextBatch)
|
||||
|
||||
// Notify the our listeners about room keys so decryption is retried.
|
||||
toDeviceEvents.events.orEmpty().forEach { event ->
|
||||
|
@ -184,7 +184,8 @@ internal class SyncResponseHandler @Inject constructor(
|
||||
syncResponse.toDevice,
|
||||
syncResponse.deviceLists,
|
||||
syncResponse.deviceOneTimeKeysCount,
|
||||
syncResponse.deviceUnusedFallbackKeyTypes
|
||||
syncResponse.deviceUnusedFallbackKeyTypes,
|
||||
syncResponse.nextBatch
|
||||
)
|
||||
}.also {
|
||||
Timber.v("Finish handling toDevice in $it ms")
|
||||
|
Loading…
Reference in New Issue
Block a user