post rebase fix rust flavor

This commit is contained in:
valere 2022-11-30 12:10:34 +01:00
parent a9b970832e
commit 501625c19d
3 changed files with 22 additions and 16 deletions

View File

@ -22,14 +22,3 @@ data class ImportRoomKeysResult(
/**It's a map from room id to a map of the sender key to a list of session*/
val importedSessionInfo: Map<String, Map<String, List<String>>>
)
// {
// companion object {
// fun fromOlm(result: KeysImportResult): ImportRoomKeysResult {
// return ImportRoomKeysResult(
// result.total.toInt(),
// result.imported.toInt(),
// result.keys
// )
// }
// }
// }

View File

@ -71,6 +71,7 @@ import org.matrix.rustcomponents.sdk.crypto.DecryptionException
import org.matrix.rustcomponents.sdk.crypto.DeviceLists
import org.matrix.rustcomponents.sdk.crypto.EncryptionSettings
import org.matrix.rustcomponents.sdk.crypto.KeyRequestPair
import org.matrix.rustcomponents.sdk.crypto.KeysImportResult
import org.matrix.rustcomponents.sdk.crypto.Logger
import org.matrix.rustcomponents.sdk.crypto.MegolmV1BackupKey
import org.matrix.rustcomponents.sdk.crypto.Request
@ -475,6 +476,14 @@ internal class OlmMachine @Inject constructor(
inner.exportRoomKeys(passphrase, rounds).toByteArray()
}
private fun KeysImportResult.fromOlm(): ImportRoomKeysResult {
return ImportRoomKeysResult(
this.total.toInt(),
this.imported.toInt(),
this.keys
)
}
/**
* Import room keys from the given serialized key export.
*
@ -497,7 +506,7 @@ internal class OlmMachine @Inject constructor(
val result = inner.importRoomKeys(decodedKeys, passphrase, rustListener)
ImportRoomKeysResult.fromOlm(result)
result.fromOlm()
}
@Throws(CryptoStoreException::class)

View File

@ -167,18 +167,22 @@ internal class RustCryptoService @Inject constructor(
}
}
override suspend fun deleteDevice(deviceId: String, userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) {
val params = DeleteDeviceTask.Params(deviceId, userInteractiveAuthInterceptor, null)
override suspend fun deleteDevices(deviceIds: List<String>, userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) {
val params = DeleteDeviceTask.Params(deviceIds, userInteractiveAuthInterceptor, null)
deleteDeviceTask.execute(params)
}
override suspend fun deleteDevice(deviceId: String, userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) {
deleteDevices(listOf(deviceId), userInteractiveAuthInterceptor)
}
override fun getCryptoVersion(context: Context, longFormat: Boolean): String {
// TODO we should provide olm and rust-sdk version from the rust-sdk
return if (longFormat) "Rust SDK 0.3" else "0.3"
}
override suspend fun getMyCryptoDevice(): CryptoDeviceInfo {
return olmMachine.ownDevice()
override fun getMyCryptoDevice(): CryptoDeviceInfo {
return runBlocking { olmMachine.ownDevice() }
}
override suspend fun fetchDevicesList(): List<DeviceInfo> {
@ -569,6 +573,10 @@ internal class RustCryptoService @Inject constructor(
megolmSessionImportManager.dispatchNewSession(roomId, sessionId)
}
override suspend fun onSyncWillProcess(isInitialSync: Boolean) {
// nothing no rust
}
override suspend fun receiveSyncChanges(
toDevice: ToDeviceSyncResponse?,
deviceChanges: DeviceListResponse?,