mirror of
https://github.com/bitwarden/android.git
synced 2026-06-07 23:11:01 -05:00
Update Bitwarden SDK to 0.3.1-20231219.150921-55 (#409)
This commit is contained in:
committed by
Álison Fernandes
parent
abe2354c15
commit
acdce7a07b
@@ -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>
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
Reference in New Issue
Block a user