Skip to content

Commit

Permalink
[PM-15918] Update bitwarden SDK (#4529)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintPatrck authored Jan 10, 2025
1 parent eef0b1c commit 0684011
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import com.bitwarden.core.RegisterKeyResponse
import com.bitwarden.core.RegisterTdeKeyResponse
import com.bitwarden.crypto.HashPurpose
import com.bitwarden.crypto.Kdf
import com.bitwarden.sdk.ClientAuth
import com.bitwarden.sdk.AuthClient
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength
import com.x8bit.bitwarden.data.auth.datasource.sdk.util.toPasswordStrengthOrNull
import com.x8bit.bitwarden.data.auth.datasource.sdk.util.toUByte
Expand All @@ -17,7 +17,7 @@ import com.x8bit.bitwarden.data.platform.manager.SdkClientManager

/**
* Primary implementation of [AuthSdkSource] that serves as a convenience wrapper around a
* [ClientAuth].
* [AuthClient].
*/
class AuthSdkSourceImpl(
sdkClientManager: SdkClientManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package com.x8bit.bitwarden.data.tools.generator.datasource.sdk
import com.bitwarden.generators.PassphraseGeneratorRequest
import com.bitwarden.generators.PasswordGeneratorRequest
import com.bitwarden.generators.UsernameGeneratorRequest
import com.bitwarden.sdk.ClientGenerators
import com.bitwarden.sdk.GeneratorClients
import com.x8bit.bitwarden.data.platform.datasource.sdk.BaseSdkSource
import com.x8bit.bitwarden.data.platform.manager.SdkClientManager

/**
* Implementation of [GeneratorSdkSource] that delegates password generation.
*
* @property sdkClientManager The [SdkClientManager] used to retrieve an instance of the
* [ClientGenerators] provided by the Bitwarden SDK.
* [GeneratorClients] provided by the Bitwarden SDK.
*/
class GeneratorSdkSourceImpl(
sdkClientManager: SdkClientManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.bitwarden.fido.Fido2CredentialAutofillView
import com.bitwarden.fido.PublicKeyCredentialAuthenticatorAssertionResponse
import com.bitwarden.fido.PublicKeyCredentialAuthenticatorAttestationResponse
import com.bitwarden.sdk.BitwardenException
import com.bitwarden.sdk.ClientVault
import com.bitwarden.sdk.VaultClient
import com.bitwarden.sdk.Fido2CredentialStore
import com.bitwarden.send.Send
import com.bitwarden.send.SendView
Expand Down Expand Up @@ -48,7 +48,7 @@ import java.io.File

/**
* Primary implementation of [VaultSdkSource] that serves as a convenience wrapper around a
* [ClientVault].
* [VaultClient].
*/
@Suppress("TooManyFunctions")
class VaultSdkSourceImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.x8bit.bitwarden.data.vault.manager

import com.bitwarden.core.InitUserCryptoMethod
import com.bitwarden.crypto.Kdf
import com.bitwarden.sdk.ClientAuth
import com.bitwarden.sdk.AuthClient
import com.x8bit.bitwarden.data.vault.manager.model.VaultStateEvent
import com.x8bit.bitwarden.data.vault.repository.model.VaultUnlockData
import com.x8bit.bitwarden.data.vault.repository.model.VaultUnlockResult
Expand Down Expand Up @@ -69,7 +69,7 @@ interface VaultLockManager {
* [vaultUnlockDataStateFlow] is up-to-date.
*
* This is only meant to be used when the SDK unlocks the vault as a side-effect of some other
* function, such as [ClientAuth.makeRegisterTdeKeys]. When using the regular [unlockVault]
* function, such as [AuthClient.makeRegisterTdeKeys]. When using the regular [unlockVault]
* functions, this is not necessary.
*/
suspend fun syncVaultState(userId: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import com.bitwarden.core.RegisterTdeKeyResponse
import com.bitwarden.crypto.HashPurpose
import com.bitwarden.crypto.Kdf
import com.bitwarden.sdk.Client
import com.bitwarden.sdk.ClientAuth
import com.bitwarden.sdk.ClientPlatform
import com.bitwarden.sdk.AuthClient
import com.bitwarden.sdk.PlatformClient
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength
import com.x8bit.bitwarden.data.platform.manager.SdkClientManager
import com.x8bit.bitwarden.data.platform.util.asSuccess
Expand All @@ -25,8 +25,8 @@ import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

class AuthSdkSourceTest {
private val clientAuth = mockk<ClientAuth>()
private val clientPlatform = mockk<ClientPlatform> {
private val clientAuth = mockk<AuthClient>()
private val clientPlatform = mockk<PlatformClient> {
coEvery { loadFlags(any()) } just runs
}
private val client = mockk<Client> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.bitwarden.generators.PassphraseGeneratorRequest
import com.bitwarden.generators.PasswordGeneratorRequest
import com.bitwarden.generators.UsernameGeneratorRequest
import com.bitwarden.sdk.Client
import com.bitwarden.sdk.ClientGenerators
import com.bitwarden.sdk.GeneratorClients
import com.x8bit.bitwarden.data.platform.manager.SdkClientManager
import com.x8bit.bitwarden.data.platform.util.asSuccess
import io.mockk.coEvery
Expand All @@ -18,7 +18,7 @@ import org.junit.Assert.assertEquals
import org.junit.Test

class GeneratorSdkSourceTest {
private val clientGenerators = mockk<ClientGenerators>()
private val clientGenerators = mockk<GeneratorClients>()
private val client = mockk<Client> {
every { generators() } returns clientGenerators
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import com.bitwarden.fido.PublicKeyCredentialAuthenticatorAttestationResponse
import com.bitwarden.fido.UnverifiedAssetLink
import com.bitwarden.sdk.BitwardenException
import com.bitwarden.sdk.Client
import com.bitwarden.sdk.ClientAuth
import com.bitwarden.sdk.AuthClient
import com.bitwarden.sdk.ClientCiphers
import com.bitwarden.sdk.ClientCrypto
import com.bitwarden.sdk.ClientExporters
import com.bitwarden.sdk.CryptoClient
import com.bitwarden.sdk.ExporterClient
import com.bitwarden.sdk.ClientFido2
import com.bitwarden.sdk.ClientFido2Authenticator
import com.bitwarden.sdk.ClientFido2Client
import com.bitwarden.sdk.ClientPasswordHistory
import com.bitwarden.sdk.ClientPlatform
import com.bitwarden.sdk.ClientSends
import com.bitwarden.sdk.ClientVault
import com.bitwarden.sdk.PlatformClient
import com.bitwarden.sdk.SendClient
import com.bitwarden.sdk.VaultClient
import com.bitwarden.sdk.Fido2CredentialStore
import com.bitwarden.send.Send
import com.bitwarden.send.SendView
Expand Down Expand Up @@ -71,25 +71,25 @@ import java.security.MessageDigest

@Suppress("LargeClass")
class VaultSdkSourceTest {
private val clientAuth = mockk<ClientAuth>()
private val clientCrypto = mockk<ClientCrypto>()
private val clientAuth = mockk<AuthClient>()
private val clientCrypto = mockk<CryptoClient>()
private val fido2 = mockk<ClientFido2Client> {
coEvery { register(any(), any(), any()) }
}
private val clientFido2 = mockk<ClientFido2> {
every { client(any(), any()) } returns fido2
}
private val clientPlatform = mockk<ClientPlatform> {
private val clientPlatform = mockk<PlatformClient> {
every { fido2() } returns clientFido2
}
private val clientPasswordHistory = mockk<ClientPasswordHistory>()
private val clientSends = mockk<ClientSends>()
private val clientSends = mockk<SendClient>()
private val clientCiphers = mockk<ClientCiphers>()
private val clientVault = mockk<ClientVault> {
private val clientVault = mockk<VaultClient> {
every { ciphers() } returns clientCiphers
every { passwordHistory() } returns clientPasswordHistory
}
private val clientExporters = mockk<ClientExporters> {
private val clientExporters = mockk<ExporterClient> {
coEvery { exportVault(any(), any(), any()) }
}
private val client = mockk<Client> {
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ androidxSplash = "1.1.0-rc01"
androidXAppCompat = "1.7.0"
androdixAutofill = "1.1.0"
androidxWork = "2.10.0"
bitwardenSdk = "1.0.0-20241030.101847-8"
bitwardenSdk = "1.0.0-20250107.132220-70"
crashlytics = "3.0.2"
detekt = "1.23.7"
firebaseBom = "33.7.0"
Expand Down

0 comments on commit 0684011

Please sign in to comment.