IUnlockManager теперь IVault

This commit is contained in:
Пытков Роман
2025-02-11 17:55:54 +03:00
parent e1646611c2
commit 85b8517a76
8 changed files with 115 additions and 28 deletions

View File

@@ -2,5 +2,6 @@ package com.github.nullptroma.wallenc.domain.enums
enum class VaultType {
LOCAL,
DECRYPTED,
YANDEX
}

View File

@@ -4,7 +4,7 @@ import com.github.nullptroma.wallenc.domain.datatypes.EncryptKey
import kotlinx.coroutines.flow.StateFlow
import java.util.UUID
interface IUnlockManager {
interface IUnlockManager: IVault {
/**
* Хранилища, для которых есть ключ шифрования
*/
@@ -12,4 +12,5 @@ interface IUnlockManager {
suspend fun open(storage: IStorage, key: EncryptKey): IStorage
suspend fun close(storage: IStorage)
suspend fun close(uuid: UUID): Unit
}

View File

@@ -4,8 +4,9 @@ import kotlinx.coroutines.flow.StateFlow
interface IVaultsManager {
val localVault: IVault
val unlockManager: IUnlockManager
val remoteVaults: StateFlow<List<IVault>>
val allStorages: StateFlow<List<IStorage>>
val allVaults: StateFlow<List<IVault>>
fun addYandexVault(email: String, token: String)
}

View File

@@ -0,0 +1,12 @@
package com.github.nullptroma.wallenc.domain.usecases
import com.github.nullptroma.wallenc.domain.interfaces.IStorage
import com.github.nullptroma.wallenc.domain.interfaces.IStorageInfo
class RemoveStorageUseCase {
suspend fun rename(storage: IStorageInfo, newName: String) {
when (storage) {
is IStorage -> storage.rename(newName)
}
}
}