mirror of
https://github.com/bitwarden/android.git
synced 2026-03-11 20:54:58 -05:00
[PM-23280] Save MasterPasswordUnlockData to local state (#5944)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.bitwarden.network.model
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* Represents the data used to create the kdf settings.
|
||||
*/
|
||||
@Serializable
|
||||
data class KdfJson(
|
||||
@SerialName("KdfType")
|
||||
val kdfType: KdfTypeJson,
|
||||
|
||||
@SerialName("Iterations")
|
||||
val iterations: Int,
|
||||
|
||||
@SerialName("Memory")
|
||||
val memory: Int?,
|
||||
|
||||
@SerialName("Parallelism")
|
||||
val parallelism: Int?,
|
||||
)
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.bitwarden.network.model
|
||||
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonNames
|
||||
|
||||
/**
|
||||
* Represents the data used to unlock with the master password.
|
||||
*/
|
||||
@Serializable
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
data class MasterPasswordUnlockDataJson(
|
||||
@SerialName("Salt")
|
||||
val salt: String,
|
||||
|
||||
@SerialName("Kdf")
|
||||
val kdf: KdfJson,
|
||||
|
||||
// TODO: PM-26397 this was done due to naming inconsistency server side,
|
||||
// should be cleaned up when server side is updated
|
||||
@SerialName("MasterKeyWrappedUserKey")
|
||||
@JsonNames("MasterKeyEncryptedUserKey")
|
||||
val masterKeyWrappedUserKey: String,
|
||||
)
|
||||
@@ -48,6 +48,9 @@ data class SyncResponseJson(
|
||||
|
||||
@SerialName("sends")
|
||||
val sends: List<Send>?,
|
||||
|
||||
@SerialName("UserDecryption")
|
||||
val userDecryption: UserDecryptionJson?,
|
||||
) {
|
||||
/**
|
||||
* Represents domains in the vault response.
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.bitwarden.network.model
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* Represents the user decryption options received on sync.
|
||||
*/
|
||||
@Serializable
|
||||
data class UserDecryptionJson(
|
||||
@SerialName("MasterPasswordUnlock")
|
||||
val masterPasswordUnlock: MasterPasswordUnlockDataJson?,
|
||||
)
|
||||
@@ -21,6 +21,10 @@ data class UserDecryptionOptionsJson(
|
||||
@JsonNames("HasMasterPassword")
|
||||
val hasMasterPassword: Boolean,
|
||||
|
||||
@SerialName("masterPasswordUnlock")
|
||||
@JsonNames("MasterPasswordUnlock")
|
||||
val masterPasswordUnlock: MasterPasswordUnlockDataJson?,
|
||||
|
||||
@SerialName("trustedDeviceOption")
|
||||
@JsonNames("TrustedDeviceOption")
|
||||
val trustedDeviceUserDecryptionOptions: TrustedDeviceUserDecryptionOptionsJson?,
|
||||
|
||||
@@ -626,6 +626,7 @@ private val LOGIN_SUCCESS = GetTokenResponseJson.Success(
|
||||
keyConnectorUserDecryptionOptions = KeyConnectorUserDecryptionOptionsJson(
|
||||
keyConnectorUrl = "keyConnectorUrl",
|
||||
),
|
||||
masterPasswordUnlock = null,
|
||||
),
|
||||
keyConnectorUrl = "keyConnectorUrl",
|
||||
)
|
||||
|
||||
@@ -13,6 +13,7 @@ fun createMockSyncResponse(
|
||||
policies: List<SyncResponseJson.Policy> = listOf(createMockPolicy(number = number)),
|
||||
domains: SyncResponseJson.Domains = createMockDomains(number = number),
|
||||
sends: List<SyncResponseJson.Send> = listOf(createMockSend(number = number)),
|
||||
userDecryption: UserDecryptionJson? = null,
|
||||
): SyncResponseJson =
|
||||
SyncResponseJson(
|
||||
folders = folders,
|
||||
@@ -22,4 +23,5 @@ fun createMockSyncResponse(
|
||||
policies = policies,
|
||||
domains = domains,
|
||||
sends = sends,
|
||||
userDecryption = userDecryption,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user