fix(vault): исправил шифрование, meta Yandex и enc-meta при первом открытии

Remember key после encrypt, мягкий auto-open в UnlockManager,
StorageMetaLoadState без затирания meta на сетевых ошибках,
фильтр storages в YandexVault и создание .enc-meta при FileNotFound.
This commit is contained in:
2026-05-21 11:05:14 +03:00
parent da8b970078
commit 467ed64426
10 changed files with 95 additions and 25 deletions

View File

@@ -46,6 +46,14 @@ class ManageStoragesEncryptionUseCase @Inject constructor(
}
}
suspend fun rememberStorageKey(storage: IStorageInfo, key: EncryptKey) {
if (storage is IStorage) {
unlockManager.rememberKey(storage, key)
return
}
throw IllegalStateException("Unsupported storage type")
}
suspend fun openStorage(storage: IStorageInfo, key: EncryptKey, rememberPassword: Boolean): IStorageInfo {
if (storage is IStorage) return unlockManager.open(storage, key, rememberPassword)
throw IllegalStateException("Unsupported storage type")

View File

@@ -1,6 +1,7 @@
package com.github.nullptroma.wallenc.usecases.fakes
import com.github.nullptroma.wallenc.domain.datatypes.StorageEncryptionInfo
import com.github.nullptroma.wallenc.domain.datatypes.StorageMetaLoadState
import com.github.nullptroma.wallenc.domain.datatypes.StorageSyncJournalEntry
import com.github.nullptroma.wallenc.domain.interfaces.IStorage
import com.github.nullptroma.wallenc.domain.interfaces.IStorageAccessor
@@ -23,6 +24,8 @@ class FakeStorage(
override val numberOfFiles: StateFlow<Int?> = MutableStateFlow(0)
override val isEmpty: Flow<Boolean?> = flowOf(true)
override val metaInfo: StateFlow<IStorageMetaInfo> = MutableStateFlow(meta)
override val metaLoadState: StateFlow<StorageMetaLoadState> =
MutableStateFlow(StorageMetaLoadState.Ready)
override val isVirtualStorage: Boolean = false
override val accessor: IStorageAccessor = accessorImpl

View File

@@ -24,6 +24,8 @@ class FakeUnlockManager : IUnlockManager {
override suspend fun open(storage: IStorage, key: EncryptKey, rememberPassword: Boolean): IStorage = storage
override suspend fun rememberKey(storage: IStorage, key: EncryptKey) = Unit
override suspend fun close(storage: IStorage) = Unit
override suspend fun close(uuid: UUID) = Unit