crypto: Connect the backup disabling method

This commit is contained in:
Damir Jelić 2021-11-04 13:32:25 +01:00
parent 5c7b248ed2
commit d6ecc7d330
2 changed files with 10 additions and 13 deletions

View file

@ -796,20 +796,28 @@ internal class OlmMachine(
}
}
@Throws(CryptoStoreException::class)
fun disableBackup() {
inner.disableBackup()
}
fun backupEnabled(): Boolean {
return inner.backupEnabled()
}
@Throws(CryptoStoreException::class)
fun roomKeyCounts(): RoomKeyCounts {
// TODO convert this to a suspendable method
return inner.roomKeyCounts()
}
@Throws(CryptoStoreException::class)
fun getBackupKeys(): BackupKeys? {
// TODO this needs to be suspendable
return inner.getBackupKeys()
}
@Throws(CryptoStoreException::class)
fun saveRecoveryKey(key: String?, version: String?) {
// TODO convert this to a suspendable method
inner.saveRecoveryKey(key, version)

View file

@ -168,7 +168,7 @@ internal class RustKeyBackupService @Inject constructor(
// Reset backup markers.
// Don't we need to join the task here? Isn't this a race condition?
cryptoCoroutineScope.launch(coroutineDispatchers.crypto) {
// TODO reset our backup state here, i.e. the `backed_up` flag on inbound group sessions
olmMachine.disableBackup()
}
val keyBackupVersion = KeysVersionResult(
@ -213,18 +213,7 @@ internal class RustKeyBackupService @Inject constructor(
*/
private fun resetKeysBackupData() {
resetBackupAllGroupSessionsListeners()
/*
TODO reset data on the rust side
cryptoStore.setKeyBackupVersion(null)
cryptoStore.setKeysBackupData(null)
backupOlmPkEncryption?.releaseEncryption()
backupOlmPkEncryption = null
// Reset backup markers
cryptoStore.resetBackupMarkers()
*/
olmMachine.disableBackup()
}
override fun deleteBackup(version: String, callback: MatrixCallback<Unit>?) {