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 { fun backupEnabled(): Boolean {
return inner.backupEnabled() return inner.backupEnabled()
} }
@Throws(CryptoStoreException::class)
fun roomKeyCounts(): RoomKeyCounts { fun roomKeyCounts(): RoomKeyCounts {
// TODO convert this to a suspendable method // TODO convert this to a suspendable method
return inner.roomKeyCounts() return inner.roomKeyCounts()
} }
@Throws(CryptoStoreException::class)
fun getBackupKeys(): BackupKeys? { fun getBackupKeys(): BackupKeys? {
// TODO this needs to be suspendable // TODO this needs to be suspendable
return inner.getBackupKeys() return inner.getBackupKeys()
} }
@Throws(CryptoStoreException::class)
fun saveRecoveryKey(key: String?, version: String?) { fun saveRecoveryKey(key: String?, version: String?) {
// TODO convert this to a suspendable method // TODO convert this to a suspendable method
inner.saveRecoveryKey(key, version) inner.saveRecoveryKey(key, version)

View File

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