diff --git a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceImpl.kt index 3836a9491..e080210b6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceImpl.kt @@ -144,7 +144,6 @@ class VaultSdkSourceImpl( ): Result = runCatching { getClient(userId = userId) - .vault() .sends() .encrypt(sendView) } @@ -156,7 +155,6 @@ class VaultSdkSourceImpl( ): Result = runCatching { getClient(userId = userId) - .vault() .sends() .encryptBuffer( send = send, @@ -172,7 +170,6 @@ class VaultSdkSourceImpl( ): Result = runCatching { getClient(userId = userId) - .vault() .sends() .encryptFile( send = send, @@ -272,7 +269,6 @@ class VaultSdkSourceImpl( ): Result = runCatching { getClient(userId = userId) - .vault() .sends() .decrypt(send) } @@ -284,7 +280,6 @@ class VaultSdkSourceImpl( runCatching { sendList.map { getClient(userId = userId) - .vault() .sends() .decrypt(it) } diff --git a/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceTest.kt index 19cfb3ea5..d659e2d53 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceTest.kt @@ -29,6 +29,7 @@ import com.bitwarden.sdk.ClientCrypto import com.bitwarden.sdk.ClientExporters import com.bitwarden.sdk.ClientPasswordHistory import com.bitwarden.sdk.ClientPlatform +import com.bitwarden.sdk.ClientSends import com.bitwarden.sdk.ClientVault import com.x8bit.bitwarden.data.platform.manager.SdkClientManager import com.x8bit.bitwarden.data.platform.util.asFailure @@ -54,6 +55,7 @@ class VaultSdkSourceTest { private val clientCrypto = mockk() private val clientPlatform = mockk() private val clientPasswordHistory = mockk() + private val clientSends = mockk() private val clientVault = mockk { every { passwordHistory() } returns clientPasswordHistory } @@ -62,6 +64,7 @@ class VaultSdkSourceTest { } private val client = mockk { every { auth() } returns clientAuth + every { sends() } returns clientSends every { vault() } returns clientVault every { platform() } returns clientPlatform every { crypto() } returns clientCrypto @@ -567,11 +570,7 @@ class VaultSdkSourceTest { val userId = "userId" val mockSend = mockk() val expectedResult = mockk() - coEvery { - clientVault.sends().decrypt( - send = mockSend, - ) - } returns expectedResult + coEvery { clientSends.decrypt(send = mockSend) } returns expectedResult val result = vaultSdkSource.decryptSendList( userId = userId, sendList = listOf(mockSend), @@ -581,11 +580,9 @@ class VaultSdkSourceTest { result, ) coVerify { - clientVault.sends().decrypt( - send = mockSend, - ) + clientSends.decrypt(send = mockSend) + sdkClientManager.getOrCreateClient(userId = userId) } - coVerify { sdkClientManager.getOrCreateClient(userId = userId) } } @Test @@ -626,7 +623,7 @@ class VaultSdkSourceTest { val userId = "userId" val expectedResult = mockk() val mockSendView = mockk() - coEvery { clientVault.sends().encrypt(send = mockSendView) } returns expectedResult + coEvery { clientSends.encrypt(send = mockSendView) } returns expectedResult val result = vaultSdkSource.encryptSend( userId = userId, @@ -635,7 +632,7 @@ class VaultSdkSourceTest { assertEquals(expectedResult.asSuccess(), result) coVerify { - clientVault.sends().encrypt(send = mockSendView) + clientSends.encrypt(send = mockSendView) } } @@ -645,11 +642,7 @@ class VaultSdkSourceTest { val userId = "userId" val mockSend = mockk() val expectedResult = mockk() - coEvery { - clientVault.sends().decrypt( - send = mockSend, - ) - } returns expectedResult + coEvery { clientSends.decrypt(send = mockSend) } returns expectedResult val result = vaultSdkSource.decryptSend( userId = userId, send = mockSend, @@ -658,11 +651,9 @@ class VaultSdkSourceTest { expectedResult.asSuccess(), result, ) coVerify { - clientVault.sends().decrypt( - send = mockSend, - ) + clientSends.decrypt(send = mockSend) + sdkClientManager.getOrCreateClient(userId = userId) } - coVerify { sdkClientManager.getOrCreateClient(userId = userId) } } @Test diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a01e86fce..bf04cbb2d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,7 @@ androidxSplash = "1.1.0-rc01" androidXAppCompat = "1.7.0" androdixAutofill = "1.1.0" androidxWork = "2.9.0" -bitwardenSdk = "0.4.0-20240415.150112-210" +bitwardenSdk = "0.5.0-20240531.135208-67" crashlytics = "3.0.1" detekt = "1.23.6" firebaseBom = "33.0.0"