post rebase fix rust flavor
This commit is contained in:
parent
a9b970832e
commit
501625c19d
@ -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*/
|
/**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>>>
|
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
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
@ -71,6 +71,7 @@ import org.matrix.rustcomponents.sdk.crypto.DecryptionException
|
|||||||
import org.matrix.rustcomponents.sdk.crypto.DeviceLists
|
import org.matrix.rustcomponents.sdk.crypto.DeviceLists
|
||||||
import org.matrix.rustcomponents.sdk.crypto.EncryptionSettings
|
import org.matrix.rustcomponents.sdk.crypto.EncryptionSettings
|
||||||
import org.matrix.rustcomponents.sdk.crypto.KeyRequestPair
|
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.Logger
|
||||||
import org.matrix.rustcomponents.sdk.crypto.MegolmV1BackupKey
|
import org.matrix.rustcomponents.sdk.crypto.MegolmV1BackupKey
|
||||||
import org.matrix.rustcomponents.sdk.crypto.Request
|
import org.matrix.rustcomponents.sdk.crypto.Request
|
||||||
@ -475,6 +476,14 @@ internal class OlmMachine @Inject constructor(
|
|||||||
inner.exportRoomKeys(passphrase, rounds).toByteArray()
|
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.
|
* 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)
|
val result = inner.importRoomKeys(decodedKeys, passphrase, rustListener)
|
||||||
|
|
||||||
ImportRoomKeysResult.fromOlm(result)
|
result.fromOlm()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(CryptoStoreException::class)
|
@Throws(CryptoStoreException::class)
|
||||||
|
@ -167,18 +167,22 @@ internal class RustCryptoService @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun deleteDevice(deviceId: String, userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) {
|
override suspend fun deleteDevices(deviceIds: List<String>, userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) {
|
||||||
val params = DeleteDeviceTask.Params(deviceId, userInteractiveAuthInterceptor, null)
|
val params = DeleteDeviceTask.Params(deviceIds, userInteractiveAuthInterceptor, null)
|
||||||
deleteDeviceTask.execute(params)
|
deleteDeviceTask.execute(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun deleteDevice(deviceId: String, userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor) {
|
||||||
|
deleteDevices(listOf(deviceId), userInteractiveAuthInterceptor)
|
||||||
|
}
|
||||||
|
|
||||||
override fun getCryptoVersion(context: Context, longFormat: Boolean): String {
|
override fun getCryptoVersion(context: Context, longFormat: Boolean): String {
|
||||||
// TODO we should provide olm and rust-sdk version from the rust-sdk
|
// TODO we should provide olm and rust-sdk version from the rust-sdk
|
||||||
return if (longFormat) "Rust SDK 0.3" else "0.3"
|
return if (longFormat) "Rust SDK 0.3" else "0.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getMyCryptoDevice(): CryptoDeviceInfo {
|
override fun getMyCryptoDevice(): CryptoDeviceInfo {
|
||||||
return olmMachine.ownDevice()
|
return runBlocking { olmMachine.ownDevice() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun fetchDevicesList(): List<DeviceInfo> {
|
override suspend fun fetchDevicesList(): List<DeviceInfo> {
|
||||||
@ -569,6 +573,10 @@ internal class RustCryptoService @Inject constructor(
|
|||||||
megolmSessionImportManager.dispatchNewSession(roomId, sessionId)
|
megolmSessionImportManager.dispatchNewSession(roomId, sessionId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override suspend fun onSyncWillProcess(isInitialSync: Boolean) {
|
||||||
|
// nothing no rust
|
||||||
|
}
|
||||||
|
|
||||||
override suspend fun receiveSyncChanges(
|
override suspend fun receiveSyncChanges(
|
||||||
toDevice: ToDeviceSyncResponse?,
|
toDevice: ToDeviceSyncResponse?,
|
||||||
deviceChanges: DeviceListResponse?,
|
deviceChanges: DeviceListResponse?,
|
||||||
|
Loading…
Reference in New Issue
Block a user