mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 07:05:35 +03:00
Update the Bitwarden SDK (#1271)
This commit is contained in:
parent
2523239557
commit
cec70a9c64
6 changed files with 19 additions and 1 deletions
|
@ -52,6 +52,7 @@ interface AuthSdkSource {
|
|||
*/
|
||||
suspend fun makeRegisterTdeKeysAndUnlockVault(
|
||||
userId: String,
|
||||
email: String,
|
||||
orgPublicKey: String,
|
||||
rememberDevice: Boolean,
|
||||
): Result<RegisterTdeKeyResponse>
|
||||
|
|
|
@ -78,12 +78,14 @@ class AuthSdkSourceImpl(
|
|||
|
||||
override suspend fun makeRegisterTdeKeysAndUnlockVault(
|
||||
userId: String,
|
||||
email: String,
|
||||
orgPublicKey: String,
|
||||
rememberDevice: Boolean,
|
||||
): Result<RegisterTdeKeyResponse> = runCatching {
|
||||
getClient(userId = userId)
|
||||
.auth()
|
||||
.makeRegisterTdeKeys(
|
||||
email = email,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = rememberDevice,
|
||||
)
|
||||
|
|
|
@ -367,6 +367,7 @@ class AuthRepositoryImpl(
|
|||
.flatMap { organizationKeys ->
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = userId,
|
||||
email = account.profile.email,
|
||||
orgPublicKey = organizationKeys.publicKey,
|
||||
rememberDevice = authDiskSource.shouldTrustDevice,
|
||||
)
|
||||
|
|
|
@ -163,12 +163,14 @@ class AuthSdkSourceTest {
|
|||
fun `makeRegisterTdeKeysAndUnlockVault should call SDK and return a Result with the correct data`() =
|
||||
runBlocking {
|
||||
val userId = "userId"
|
||||
val email = "email"
|
||||
val orgPublicKey = "orgPublicKey"
|
||||
val rememberDevice = true
|
||||
val expectedResult = mockk<RegisterTdeKeyResponse>()
|
||||
coEvery { sdkClientManager.getOrCreateClient(userId = userId) } returns client
|
||||
coEvery {
|
||||
clientAuth.makeRegisterTdeKeys(
|
||||
email = email,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = rememberDevice,
|
||||
)
|
||||
|
@ -176,12 +178,14 @@ class AuthSdkSourceTest {
|
|||
|
||||
val result = authSkdSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = userId,
|
||||
email = email,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = rememberDevice,
|
||||
)
|
||||
assertEquals(expectedResult.asSuccess(), result)
|
||||
coVerify(exactly = 1) {
|
||||
clientAuth.makeRegisterTdeKeys(
|
||||
email = email,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = rememberDevice,
|
||||
)
|
||||
|
|
|
@ -823,6 +823,7 @@ class AuthRepositoryTest {
|
|||
coEvery {
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
@ -836,6 +837,7 @@ class AuthRepositoryTest {
|
|||
organizationService.getOrganizationKeys(orgId)
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
@ -877,6 +879,7 @@ class AuthRepositoryTest {
|
|||
coEvery {
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
@ -896,6 +899,7 @@ class AuthRepositoryTest {
|
|||
organizationService.getOrganizationKeys(orgId)
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
@ -941,6 +945,7 @@ class AuthRepositoryTest {
|
|||
coEvery {
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
@ -968,6 +973,7 @@ class AuthRepositoryTest {
|
|||
organizationService.getOrganizationKeys(orgId)
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
@ -1021,6 +1027,7 @@ class AuthRepositoryTest {
|
|||
coEvery {
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
@ -1050,6 +1057,7 @@ class AuthRepositoryTest {
|
|||
organizationService.getOrganizationKeys(orgId)
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
@ -1104,6 +1112,7 @@ class AuthRepositoryTest {
|
|||
coEvery {
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
@ -1139,6 +1148,7 @@ class AuthRepositoryTest {
|
|||
organizationService.getOrganizationKeys(orgId)
|
||||
authSdkSource.makeRegisterTdeKeysAndUnlockVault(
|
||||
userId = USER_ID_1,
|
||||
email = EMAIL,
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = shouldTrustDevice,
|
||||
)
|
||||
|
|
|
@ -23,7 +23,7 @@ androidxSplash = "1.1.0-rc01"
|
|||
androidXAppCompat = "1.6.1"
|
||||
androdixAutofill = "1.1.0"
|
||||
androidxWork = "2.9.0"
|
||||
bitwardenSdk = "0.4.0-20240412.113052-206"
|
||||
bitwardenSdk = "0.4.0-20240415.150112-210"
|
||||
crashlytics = "2.9.9"
|
||||
detekt = "1.23.6"
|
||||
firebaseBom = "32.8.1"
|
||||
|
|
Loading…
Reference in a new issue