mirror of
https://github.com/bitwarden/android.git
synced 2026-06-07 23:58:03 -05:00
Delete the users vault data on logout (#418)
This commit is contained in:
committed by
Álison Fernandes
parent
772d6693a6
commit
f2f3a6a386
@@ -267,6 +267,9 @@ class AuthRepositoryImpl constructor(
|
||||
authDiskSource.userState = null
|
||||
}
|
||||
|
||||
// Delete all the vault data
|
||||
vaultRepository.deleteVaultData(userId)
|
||||
|
||||
// Lock the vault for the logged out user
|
||||
vaultRepository.lockVaultIfNecessary(userId)
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import kotlinx.coroutines.flow.StateFlow
|
||||
/**
|
||||
* Responsible for managing vault data inside the network layer.
|
||||
*/
|
||||
@Suppress("TooManyFunctions")
|
||||
interface VaultRepository {
|
||||
|
||||
/**
|
||||
@@ -53,6 +54,11 @@ interface VaultRepository {
|
||||
*/
|
||||
fun clearUnlockedData()
|
||||
|
||||
/**
|
||||
* Completely remove any persisted data from the vault.
|
||||
*/
|
||||
fun deleteVaultData(userId: String)
|
||||
|
||||
/**
|
||||
* Attempt to sync the vault data.
|
||||
*/
|
||||
|
||||
@@ -143,6 +143,12 @@ class VaultRepositoryImpl(
|
||||
sendDataMutableStateFlow.update { DataState.Loading }
|
||||
}
|
||||
|
||||
override fun deleteVaultData(userId: String) {
|
||||
scope.launch {
|
||||
vaultDiskSource.deleteVaultData(userId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun sync() {
|
||||
if (!syncJob.isCompleted || willSyncAfterUnlock) return
|
||||
val userId = activeUserId ?: return
|
||||
|
||||
Reference in New Issue
Block a user