mirror of
https://github.com/bitwarden/android.git
synced 2026-06-02 02:36:58 -05:00
Add makeRegisterTdeKeysAndUnlockVault to authSdkSource (#1245)
This commit is contained in:
committed by
Álison Fernandes
parent
de39f76627
commit
92e39f25c1
@@ -3,6 +3,7 @@ package com.x8bit.bitwarden.data.auth.datasource.sdk
|
||||
import com.bitwarden.core.AuthRequestResponse
|
||||
import com.bitwarden.core.MasterPasswordPolicyOptions
|
||||
import com.bitwarden.core.RegisterKeyResponse
|
||||
import com.bitwarden.core.RegisterTdeKeyResponse
|
||||
import com.bitwarden.crypto.HashPurpose
|
||||
import com.bitwarden.crypto.Kdf
|
||||
import com.x8bit.bitwarden.data.auth.datasource.sdk.model.PasswordStrength
|
||||
@@ -45,6 +46,16 @@ interface AuthSdkSource {
|
||||
kdf: Kdf,
|
||||
): Result<RegisterKeyResponse>
|
||||
|
||||
/**
|
||||
* Creates a set of encryption key information for registration of a trusted device and unlocks
|
||||
* the vault for the user.
|
||||
*/
|
||||
suspend fun makeRegisterTdeKeysAndUnlockVault(
|
||||
userId: String,
|
||||
orgPublicKey: String,
|
||||
rememberDevice: Boolean,
|
||||
): Result<RegisterTdeKeyResponse>
|
||||
|
||||
/**
|
||||
* Checks the password strength for the given [email] and [password] combination, along with
|
||||
* some [additionalInputs].
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.bitwarden.core.AuthRequestResponse
|
||||
import com.bitwarden.core.FingerprintRequest
|
||||
import com.bitwarden.core.MasterPasswordPolicyOptions
|
||||
import com.bitwarden.core.RegisterKeyResponse
|
||||
import com.bitwarden.core.RegisterTdeKeyResponse
|
||||
import com.bitwarden.crypto.HashPurpose
|
||||
import com.bitwarden.crypto.Kdf
|
||||
import com.bitwarden.sdk.Client
|
||||
@@ -75,6 +76,19 @@ class AuthSdkSourceImpl(
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun makeRegisterTdeKeysAndUnlockVault(
|
||||
userId: String,
|
||||
orgPublicKey: String,
|
||||
rememberDevice: Boolean,
|
||||
): Result<RegisterTdeKeyResponse> = runCatching {
|
||||
getClient(userId = userId)
|
||||
.auth()
|
||||
.makeRegisterTdeKeys(
|
||||
orgPublicKey = orgPublicKey,
|
||||
rememberDevice = rememberDevice,
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun passwordStrength(
|
||||
email: String,
|
||||
password: String,
|
||||
|
||||
Reference in New Issue
Block a user