fix(vault): исправил шифрование, meta Yandex и enc-meta при первом открытии
Remember key после encrypt, мягкий auto-open в UnlockManager, StorageMetaLoadState без затирания meta на сетевых ошибках, фильтр storages в YandexVault и создание .enc-meta при FileNotFound.
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user