From f7139b8b9187d557ed7be5d2f35fbc45142e81ee Mon Sep 17 00:00:00 2001 From: Patrick Honkonen <1883101+SaintPatrck@users.noreply.github.com> Date: Thu, 28 Aug 2025 11:47:44 -0400 Subject: [PATCH] [PM-25239] Remove unnecessary vault sync from `Fido2CredentialStoreImpl` (#5794) --- .../sdk/model/Fido2CredentialStoreImpl.kt | 37 +++++-------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/app/src/main/kotlin/com/x8bit/bitwarden/data/vault/datasource/sdk/model/Fido2CredentialStoreImpl.kt b/app/src/main/kotlin/com/x8bit/bitwarden/data/vault/datasource/sdk/model/Fido2CredentialStoreImpl.kt index a0e20f5939..8f0f596be2 100644 --- a/app/src/main/kotlin/com/x8bit/bitwarden/data/vault/datasource/sdk/model/Fido2CredentialStoreImpl.kt +++ b/app/src/main/kotlin/com/x8bit/bitwarden/data/vault/datasource/sdk/model/Fido2CredentialStoreImpl.kt @@ -12,7 +12,6 @@ import com.x8bit.bitwarden.data.platform.error.NoActiveUserException import com.x8bit.bitwarden.data.vault.datasource.sdk.VaultSdkSource import com.x8bit.bitwarden.data.vault.manager.model.GetCipherResult import com.x8bit.bitwarden.data.vault.repository.VaultRepository -import com.x8bit.bitwarden.data.vault.repository.model.SyncVaultDataResult import timber.log.Timber /** @@ -28,21 +27,13 @@ class Fido2CredentialStoreImpl( /** * Return all active ciphers that contain FIDO 2 credentials. */ - override suspend fun allCredentials(): List { - val syncResult = vaultRepository.syncForResult() - if (syncResult is SyncVaultDataResult.Error) { - syncResult.throwable - ?.let { throw it } - ?: throw IllegalStateException("Sync failed.") - } - return vaultRepository - .decryptCipherListResultStateFlow - .value - .data - ?.successes - .orEmpty() - .filter { it.isActiveWithFido2Credentials } - } + override suspend fun allCredentials(): List = vaultRepository + .decryptCipherListResultStateFlow + .value + .data + ?.successes + .orEmpty() + .filter { it.isActiveWithFido2Credentials } /** * Returns ciphers that contain FIDO 2 credentials for the given [ripId] with the provided @@ -51,15 +42,8 @@ class Fido2CredentialStoreImpl( * @param ids Optional list of FIDO 2 credential ID's to find. * @param ripId Relying Party ID to find. */ - override suspend fun findCredentials(ids: List?, ripId: String): List { - val syncResult = vaultRepository.syncForResult() - if (syncResult is SyncVaultDataResult.Error) { - syncResult.throwable - ?.let { throw it } - ?: throw IllegalStateException("Sync failed.") - } - - return vaultRepository + override suspend fun findCredentials(ids: List?, ripId: String): List = + vaultRepository .decryptCipherListResultStateFlow .value .data @@ -78,7 +62,6 @@ class Fido2CredentialStoreImpl( .toCipherViewOrNull() } } - } /** * Save the provided [cred] to the users vault. @@ -95,7 +78,7 @@ class Fido2CredentialStoreImpl( ?: vaultRepository.createCipher(decryptedCipherView) } .onFailure { throw it } - } + } /** * Return a filtered list containing elements that match the given [relyingPartyId] and a