Update Bitwarden SDK to 0.3.1-20231219.150921-55 (#409)

This commit is contained in:
Brian Yencho
2023-12-19 11:47:27 -06:00
committed by Álison Fernandes
parent abe2354c15
commit acdce7a07b
6 changed files with 23 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
package com.x8bit.bitwarden.data.auth.datasource.sdk
import com.bitwarden.core.HashPurpose
import com.bitwarden.core.Kdf
import com.bitwarden.core.MasterPasswordPolicyOptions
import com.bitwarden.core.RegisterKeyResponse
@@ -10,13 +11,13 @@ import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength
*/
interface AuthSdkSource {
/**
* Creates a hashed password provided the given [email], [password], and [kdf].
* [kdf].
* Creates a hashed password provided the given [email], [password], [kdf], and [purpose].
*/
suspend fun hashPassword(
email: String,
password: String,
kdf: Kdf,
purpose: HashPurpose,
): Result<String>
/**

View File

@@ -1,5 +1,6 @@
package com.x8bit.bitwarden.data.auth.datasource.sdk
import com.bitwarden.core.HashPurpose
import com.bitwarden.core.Kdf
import com.bitwarden.core.MasterPasswordPolicyOptions
import com.bitwarden.core.RegisterKeyResponse
@@ -20,11 +21,13 @@ class AuthSdkSourceImpl(
email: String,
password: String,
kdf: Kdf,
purpose: HashPurpose,
): Result<String> = runCatching {
clientAuth.hashPassword(
email = email,
password = password,
kdfParams = kdf,
purpose = purpose,
)
}

View File

@@ -1,5 +1,6 @@
package com.x8bit.bitwarden.data.auth.repository
import com.bitwarden.core.HashPurpose
import com.bitwarden.core.Kdf
import com.x8bit.bitwarden.data.auth.datasource.disk.AuthDiskSource
import com.x8bit.bitwarden.data.auth.datasource.network.model.GetTokenResponseJson
@@ -133,6 +134,7 @@ class AuthRepositoryImpl constructor(
email = profile.email,
password = password,
kdf = profile.toSdkParams(),
purpose = HashPurpose.SERVER_AUTHORIZATION,
)
.flatMap { hashedPassword -> accountsService.deleteAccount(hashedPassword) }
.onSuccess { logout() }
@@ -154,6 +156,7 @@ class AuthRepositoryImpl constructor(
email = email,
password = password,
kdf = it.kdfParams.toSdkParams(),
purpose = HashPurpose.SERVER_AUTHORIZATION,
)
}
.flatMap { passwordHash ->