fix rust device to CryptoDeviceInfo mapping

This commit is contained in:
Valere 2024-03-14 10:54:31 +01:00
parent def2a8a833
commit 3fa3eb1129
2 changed files with 9 additions and 7 deletions

View file

@ -172,8 +172,6 @@ internal class Device @AssistedInject constructor(
* This will not fetch out fresh data from the Rust side.
**/
internal fun toCryptoDeviceInfo(): CryptoDeviceInfo {
// val keys = innerDevice.keys.map { (keyId, key) -> keyId to key }.toMap()
return CryptoDeviceInfo(
deviceId = innerDevice.deviceId,
userId = innerDevice.userId,

View file

@ -189,18 +189,21 @@ internal class OlmMachine @Inject constructor(
is OwnUserIdentity -> ownIdentity.trustsOurOwnDevice()
else -> false
}
val ownDevice = inner.getDevice(userId(), deviceId, 0u)!!
val creationTime = ownDevice.firstTimeSeenTs.toLong()
return CryptoDeviceInfo(
deviceId(),
userId(),
// TODO pass the algorithms here.
listOf(),
ownDevice.algorithms,
keys,
mapOf(),
UnsignedDeviceInfo(),
UnsignedDeviceInfo(
deviceDisplayName = ownDevice.displayName
),
DeviceTrustLevel(crossSigningVerified, locallyVerified = true),
false,
null
creationTime
)
}
@ -882,6 +885,7 @@ internal class OlmMachine @Inject constructor(
inner.queryMissingSecretsFromOtherSessions()
}
}
@Throws(CryptoStoreException::class)
suspend fun enableBackupV1(key: String, version: String) {
return withContext(coroutineDispatchers.computation) {