mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 07:05:35 +03:00
PM-11140: Update hasMasterPassword logic for key connectors (#3775)
This commit is contained in:
parent
9e372c29d1
commit
397c78b4af
33 changed files with 81 additions and 38 deletions
|
@ -45,6 +45,7 @@ data class UserState(
|
|||
* they logged in using SSO and don't yet have one). NOTE: This should **not** be used to
|
||||
* determine whether a user has a master password. There are cases in which a user can both
|
||||
* not have a password but still not need one, such as TDE.
|
||||
* @property hasMasterPassword Indicates that the user does or does not have a master password.
|
||||
* @property organizations List of [Organization]s the user is associated with, if any.
|
||||
* @property isBiometricsEnabled Indicates that the biometrics mechanism for unlocking the
|
||||
* user's vault is enabled.
|
||||
|
@ -61,16 +62,12 @@ data class UserState(
|
|||
val isVaultUnlocked: Boolean,
|
||||
val needsPasswordReset: Boolean,
|
||||
val needsMasterPassword: Boolean,
|
||||
val hasMasterPassword: Boolean,
|
||||
val trustedDevice: TrustedDevice?,
|
||||
val organizations: List<Organization>,
|
||||
val isBiometricsEnabled: Boolean,
|
||||
val vaultUnlockType: VaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
) {
|
||||
/**
|
||||
* Indicates that the user does or does not have a master password.
|
||||
*/
|
||||
val hasMasterPassword: Boolean get() = trustedDevice?.hasMasterPassword != false
|
||||
|
||||
/**
|
||||
* Indicates that the user does or does not have a means to manually unlock the vault.
|
||||
*/
|
||||
|
@ -86,7 +83,6 @@ data class UserState(
|
|||
*/
|
||||
data class TrustedDevice(
|
||||
val isDeviceTrusted: Boolean,
|
||||
val hasMasterPassword: Boolean,
|
||||
val hasAdminApproval: Boolean,
|
||||
val hasLoginApprovingDevice: Boolean,
|
||||
val hasResetPasswordPermission: Boolean,
|
||||
|
|
|
@ -103,7 +103,6 @@ fun UserStateJson.toUserState(
|
|||
val trustedDevice = trustedDeviceOptions?.let {
|
||||
UserState.TrustedDevice(
|
||||
isDeviceTrusted = isDeviceTrustedProvider(userId),
|
||||
hasMasterPassword = decryptionOptions.hasMasterPassword,
|
||||
hasAdminApproval = it.hasAdminApproval,
|
||||
hasLoginApprovingDevice = it.hasLoginApprovingDevice,
|
||||
hasResetPasswordPermission = it.hasManageResetPasswordPermission,
|
||||
|
@ -132,6 +131,7 @@ fun UserStateJson.toUserState(
|
|||
isBiometricsEnabled = isBiometricsEnabledProvider(userId),
|
||||
vaultUnlockType = vaultUnlockTypeProvider(userId),
|
||||
needsMasterPassword = needsMasterPassword,
|
||||
hasMasterPassword = decryptionOptions?.hasMasterPassword != false,
|
||||
trustedDevice = trustedDevice,
|
||||
)
|
||||
},
|
||||
|
|
|
@ -41,11 +41,11 @@ class TrustedDeviceViewModel @Inject constructor(
|
|||
environmentLabel = environmentRepository.environment.label,
|
||||
isRemembered = true,
|
||||
showContinueButton = trustedDevice
|
||||
?.let { !it.hasAdminApproval && !it.hasMasterPassword }
|
||||
?.let { !it.hasAdminApproval && !account.hasMasterPassword }
|
||||
?: false,
|
||||
showOtherDeviceButton = trustedDevice?.hasLoginApprovingDevice ?: false,
|
||||
showRequestAdminButton = trustedDevice?.hasAdminApproval ?: false,
|
||||
showMasterPasswordButton = trustedDevice?.hasMasterPassword ?: false,
|
||||
showMasterPasswordButton = account?.hasMasterPassword ?: false,
|
||||
)
|
||||
},
|
||||
) {
|
||||
|
|
|
@ -52,17 +52,17 @@ class VaultUnlockViewModel @Inject constructor(
|
|||
// We load the state from the savedStateHandle for testing purposes.
|
||||
initialState = savedStateHandle[KEY_STATE] ?: run {
|
||||
val userState = requireNotNull(authRepository.userStateFlow.value)
|
||||
val trustedDevice = userState.activeAccount.trustedDevice
|
||||
val activeAccount = userState.activeAccount
|
||||
val accountSummaries = userState.toAccountSummaries()
|
||||
val activeAccountSummary = userState.toActiveAccountSummary()
|
||||
val isBiometricsValid = biometricsEncryptionManager.isBiometricIntegrityValid(
|
||||
userId = userState.activeUserId,
|
||||
cipher = biometricsEncryptionManager.getOrCreateCipher(userState.activeUserId),
|
||||
)
|
||||
val vaultUnlockType = userState.activeAccount.vaultUnlockType
|
||||
val hasNoMasterPassword = trustedDevice?.hasMasterPassword == false
|
||||
val vaultUnlockType = activeAccount.vaultUnlockType
|
||||
val hasNoMasterPassword = !activeAccount.hasMasterPassword
|
||||
val hideInput = hasNoMasterPassword && vaultUnlockType == VaultUnlockType.MASTER_PASSWORD
|
||||
val isBiometricsEnabled = userState.activeAccount.isBiometricsEnabled
|
||||
val isBiometricsEnabled = activeAccount.isBiometricsEnabled
|
||||
if (hasNoMasterPassword && vaultUnlockType != VaultUnlockType.PIN && !isBiometricsEnabled) {
|
||||
// There is no valid way to unlock this app.
|
||||
authRepository.logout()
|
||||
|
|
|
@ -63,7 +63,6 @@ class AccountSecurityViewModel @Inject constructor(
|
|||
.userStateFlow
|
||||
.value
|
||||
?.activeAccount
|
||||
?.trustedDevice
|
||||
?.hasMasterPassword != false,
|
||||
isUnlockWithPinEnabled = settingsRepository.isUnlockWithPinEnabled,
|
||||
userId = userId,
|
||||
|
|
|
@ -34,8 +34,7 @@ class DeleteAccountViewModel @Inject constructor(
|
|||
dialog = null,
|
||||
isUnlockWithPasswordEnabled = requireNotNull(authRepository.userStateFlow.value)
|
||||
.activeAccount
|
||||
.trustedDevice
|
||||
?.hasMasterPassword != false,
|
||||
.hasMasterPassword,
|
||||
),
|
||||
) {
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ class ExportVaultViewModel @Inject constructor(
|
|||
.userStateFlow
|
||||
.value
|
||||
?.activeAccount
|
||||
?.trustedDevice
|
||||
?.hasMasterPassword == false,
|
||||
),
|
||||
) {
|
||||
|
|
|
@ -128,8 +128,7 @@ fun VaultAddEditState.ViewState.appendFolderAndOwnerData(
|
|||
cipherView = currentContentState.common.originalCipher,
|
||||
isIndividualVaultDisabled = isIndividualVaultDisabled,
|
||||
),
|
||||
isUnlockWithPasswordEnabled =
|
||||
activeAccount.trustedDevice?.hasMasterPassword != false,
|
||||
isUnlockWithPasswordEnabled = activeAccount.hasMasterPassword,
|
||||
),
|
||||
)
|
||||
} ?: this
|
||||
|
|
|
@ -777,6 +777,7 @@ private val DEFAULT_ACCOUNT = UserState.Account(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
private val DEFAULT_USER_STATE = UserState(
|
||||
|
|
|
@ -235,6 +235,7 @@ class UserStateJsonExtensionsTest {
|
|||
vaultUnlockType = VaultUnlockType.PIN,
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -325,6 +326,7 @@ class UserStateJsonExtensionsTest {
|
|||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
needsMasterPassword = true,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
hasPendingAccountAddition = true,
|
||||
|
@ -413,11 +415,11 @@ class UserStateJsonExtensionsTest {
|
|||
needsMasterPassword = false,
|
||||
trustedDevice = UserState.TrustedDevice(
|
||||
isDeviceTrusted = true,
|
||||
hasMasterPassword = false,
|
||||
hasAdminApproval = false,
|
||||
hasLoginApprovingDevice = true,
|
||||
hasResetPasswordPermission = false,
|
||||
),
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
hasPendingAccountAddition = true,
|
||||
|
|
|
@ -530,6 +530,7 @@ private fun createMockAccounts(number: Int): List<UserState.Account> {
|
|||
organizations = emptyList(),
|
||||
isBiometricsEnabled = false,
|
||||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -300,6 +300,7 @@ private val DEFAULT_USER_STATE: UserState = UserState(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -78,6 +78,7 @@ class LandingViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -212,6 +213,7 @@ class LandingViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
val userState = UserState(
|
||||
activeUserId = "activeUserId",
|
||||
|
@ -265,6 +267,7 @@ class LandingViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
val userState = UserState(
|
||||
activeUserId = "activeUserId",
|
||||
|
@ -322,6 +325,7 @@ class LandingViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
val userState = UserState(
|
||||
activeUserId = "activeUserId",
|
||||
|
@ -481,6 +485,7 @@ class LandingViewModelTest : BaseViewModelTest() {
|
|||
organizations = listOf(),
|
||||
isBiometricsEnabled = false,
|
||||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
val userState = UserState(
|
||||
|
@ -513,6 +518,7 @@ class LandingViewModelTest : BaseViewModelTest() {
|
|||
organizations = listOf(),
|
||||
isBiometricsEnabled = false,
|
||||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
val userState = UserState(
|
||||
|
|
|
@ -127,6 +127,7 @@ class LoginViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -253,7 +253,6 @@ private val DEFAULT_AUTH_STATE: AuthState = AuthState.Authenticated(accessToken
|
|||
|
||||
private val TRUSTED_DEVICE = UserState.TrustedDevice(
|
||||
isDeviceTrusted = false,
|
||||
hasMasterPassword = false,
|
||||
hasAdminApproval = true,
|
||||
hasLoginApprovingDevice = true,
|
||||
hasResetPasswordPermission = false,
|
||||
|
@ -273,6 +272,7 @@ private val DEFAULT_ACCOUNT = UserState.Account(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = TRUSTED_DEVICE,
|
||||
hasMasterPassword = false,
|
||||
)
|
||||
|
||||
private val DEFAULT_USER_STATE = UserState(
|
||||
|
|
|
@ -109,7 +109,7 @@ class VaultUnlockViewModelTest : BaseViewModelTest() {
|
|||
DEFAULT_ACCOUNT.copy(
|
||||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
isBiometricsEnabled = false,
|
||||
trustedDevice = TRUSTED_DEVICE,
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -128,6 +128,7 @@ class VaultUnlockViewModelTest : BaseViewModelTest() {
|
|||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
isBiometricsEnabled = true,
|
||||
trustedDevice = TRUSTED_DEVICE,
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -146,6 +147,7 @@ class VaultUnlockViewModelTest : BaseViewModelTest() {
|
|||
vaultUnlockType = VaultUnlockType.PIN,
|
||||
isBiometricsEnabled = false,
|
||||
trustedDevice = TRUSTED_DEVICE,
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -210,6 +212,7 @@ class VaultUnlockViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -246,6 +249,7 @@ class VaultUnlockViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -436,7 +440,7 @@ class VaultUnlockViewModelTest : BaseViewModelTest() {
|
|||
val account = DEFAULT_ACCOUNT.copy(
|
||||
isVaultUnlocked = false,
|
||||
isBiometricsEnabled = true,
|
||||
)
|
||||
)
|
||||
val initialState = DEFAULT_STATE.copy(isBiometricsValid = true)
|
||||
val viewModel = createViewModel(state = initialState)
|
||||
mutableUserStateFlow.update {
|
||||
|
@ -984,7 +988,6 @@ private val DEFAULT_STATE: VaultUnlockState = VaultUnlockState(
|
|||
|
||||
private val TRUSTED_DEVICE: UserState.TrustedDevice = UserState.TrustedDevice(
|
||||
isDeviceTrusted = false,
|
||||
hasMasterPassword = false,
|
||||
hasAdminApproval = false,
|
||||
hasLoginApprovingDevice = false,
|
||||
hasResetPasswordPermission = false,
|
||||
|
@ -1004,6 +1007,7 @@ private val DEFAULT_ACCOUNT = UserState.Account(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
private val DEFAULT_USER_STATE = UserState(
|
||||
|
|
|
@ -73,6 +73,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -104,6 +105,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -132,6 +134,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = true,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -164,11 +167,11 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
needsMasterPassword = false,
|
||||
trustedDevice = UserState.TrustedDevice(
|
||||
isDeviceTrusted = false,
|
||||
hasMasterPassword = false,
|
||||
hasAdminApproval = true,
|
||||
hasLoginApprovingDevice = true,
|
||||
hasResetPasswordPermission = false,
|
||||
),
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -199,11 +202,11 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
needsMasterPassword = false,
|
||||
trustedDevice = UserState.TrustedDevice(
|
||||
isDeviceTrusted = false,
|
||||
hasMasterPassword = true,
|
||||
hasAdminApproval = true,
|
||||
hasLoginApprovingDevice = true,
|
||||
hasResetPasswordPermission = false,
|
||||
),
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -234,11 +237,11 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
needsMasterPassword = false,
|
||||
trustedDevice = UserState.TrustedDevice(
|
||||
isDeviceTrusted = false,
|
||||
hasMasterPassword = false,
|
||||
hasAdminApproval = true,
|
||||
hasLoginApprovingDevice = true,
|
||||
hasResetPasswordPermission = false,
|
||||
),
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -271,6 +274,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
hasPendingAccountAddition = true,
|
||||
|
@ -303,6 +307,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -340,6 +345,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -377,6 +383,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -420,6 +427,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -464,6 +472,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -503,6 +512,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -541,6 +551,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -614,6 +625,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -662,6 +674,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -698,6 +711,7 @@ class RootNavViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1416,6 +1416,7 @@ private val DEFAULT_USER_STATE = UserState(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -639,6 +639,7 @@ private val DEFAULT_USER_STATE = UserState(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -34,11 +34,7 @@ class DeleteAccountViewModelTest : BaseViewModelTest() {
|
|||
mutableUserStateFlow.update { currentState ->
|
||||
currentState.copy(
|
||||
accounts = currentState.accounts.map { account ->
|
||||
account.copy(
|
||||
trustedDevice = account.trustedDevice?.copy(
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
)
|
||||
account.copy(hasMasterPassword = false)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -240,11 +236,11 @@ private val DEFAULT_USER_STATE: UserState = UserState(
|
|||
needsMasterPassword = false,
|
||||
trustedDevice = UserState.TrustedDevice(
|
||||
isDeviceTrusted = true,
|
||||
hasMasterPassword = true,
|
||||
hasAdminApproval = true,
|
||||
hasLoginApprovingDevice = true,
|
||||
hasResetPasswordPermission = true,
|
||||
),
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -368,6 +368,7 @@ private val DEFAULT_USER_STATE = UserState(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -720,6 +720,7 @@ private val DEFAULT_USER_STATE = UserState(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -2404,6 +2404,7 @@ private val DEFAULT_USER_STATE = UserState(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1099,6 +1099,7 @@ class AddSendViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
private val DEFAULT_USER_STATE = UserState(
|
||||
|
|
|
@ -917,7 +917,6 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
|||
@Test
|
||||
fun `in add mode during fido2, SaveClick should show fido2 error dialog when create options are null`() =
|
||||
runTest {
|
||||
val mockUserId = "mockUserId"
|
||||
val fido2CredentialRequest = createMockFido2CredentialRequest(number = 1)
|
||||
specialCircumstanceManager.specialCircumstance =
|
||||
SpecialCircumstance.Fido2Save(
|
||||
|
@ -3216,11 +3215,11 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
|||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
trustedDevice = UserState.TrustedDevice(
|
||||
isDeviceTrusted = true,
|
||||
hasMasterPassword = false,
|
||||
hasAdminApproval = true,
|
||||
hasLoginApprovingDevice = true,
|
||||
hasResetPasswordPermission = true,
|
||||
),
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -3885,6 +3884,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() {
|
|||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
hasPendingAccountAddition = false,
|
||||
|
|
|
@ -440,6 +440,7 @@ class CipherViewExtensionsTest {
|
|||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -560,6 +560,7 @@ private val DEFAULT_USER_STATE = UserState(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -2577,6 +2577,7 @@ class VaultItemViewModelTest : BaseViewModelTest() {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -2762,14 +2762,13 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
accounts = listOf(
|
||||
DEFAULT_ACCOUNT.copy(
|
||||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
|
||||
trustedDevice = UserState.TrustedDevice(
|
||||
isDeviceTrusted = true,
|
||||
hasMasterPassword = false,
|
||||
hasAdminApproval = true,
|
||||
hasLoginApprovingDevice = true,
|
||||
hasResetPasswordPermission = true,
|
||||
),
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -3157,11 +3156,11 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
vaultUnlockType = VaultUnlockType.MASTER_PASSWORD,
|
||||
trustedDevice = UserState.TrustedDevice(
|
||||
isDeviceTrusted = true,
|
||||
hasMasterPassword = false,
|
||||
hasAdminApproval = true,
|
||||
hasLoginApprovingDevice = true,
|
||||
hasResetPasswordPermission = true,
|
||||
),
|
||||
hasMasterPassword = false,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -3784,6 +3783,7 @@ private val DEFAULT_ACCOUNT = UserState.Account(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
private val DEFAULT_USER_STATE = UserState(
|
||||
|
|
|
@ -501,6 +501,7 @@ private val DEFAULT_USER_STATE = UserState(
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -116,6 +116,7 @@ private fun createMockUserState(hasOrganizations: Boolean = true): UserState =
|
|||
emptyList()
|
||||
},
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -190,6 +190,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -269,6 +270,7 @@ class VaultViewModelTest : BaseViewModelTest() {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -1515,6 +1517,7 @@ private val DEFAULT_USER_STATE = UserState(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
UserState.Account(
|
||||
userId = "lockedUserId",
|
||||
|
@ -1530,6 +1533,7 @@ private val DEFAULT_USER_STATE = UserState(
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -79,6 +79,7 @@ class UserStateExtensionsTest {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
UserState.Account(
|
||||
userId = "lockedUserId",
|
||||
|
@ -99,6 +100,7 @@ class UserStateExtensionsTest {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
UserState.Account(
|
||||
userId = "unlockedUserId",
|
||||
|
@ -123,6 +125,7 @@ class UserStateExtensionsTest {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
UserState.Account(
|
||||
userId = "loggedOutUserId",
|
||||
|
@ -147,6 +150,7 @@ class UserStateExtensionsTest {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -186,6 +190,7 @@ class UserStateExtensionsTest {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
.toAccountSummary(isActive = true),
|
||||
)
|
||||
|
@ -223,6 +228,7 @@ class UserStateExtensionsTest {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
.toAccountSummary(isActive = false),
|
||||
)
|
||||
|
@ -264,6 +270,7 @@ class UserStateExtensionsTest {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -288,6 +295,7 @@ class UserStateExtensionsTest {
|
|||
organizations = emptyList(),
|
||||
needsMasterPassword = false,
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
.toVaultFilterData(isIndividualVaultDisabled = false),
|
||||
)
|
||||
|
@ -335,6 +343,7 @@ class UserStateExtensionsTest {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
.toVaultFilterData(
|
||||
isIndividualVaultDisabled = false,
|
||||
|
@ -383,6 +392,7 @@ class UserStateExtensionsTest {
|
|||
),
|
||||
),
|
||||
trustedDevice = null,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
.toVaultFilterData(
|
||||
isIndividualVaultDisabled = true,
|
||||
|
|
Loading…
Reference in a new issue