[PM-32009] feat: Add infrastructure for new vault item types (#6828)

This commit is contained in:
Patrick Honkonen
2026-05-04 12:40:44 -04:00
committed by GitHub
parent 67182df91b
commit 8223fb3089
46 changed files with 1595 additions and 62 deletions

View File

@@ -56,6 +56,15 @@ data class CipherJsonRequest(
@SerialName("sshKey")
val sshKey: SyncResponseJson.Cipher.SshKey?,
@SerialName("bankAccount")
val bankAccount: SyncResponseJson.Cipher.BankAccount?,
@SerialName("driversLicense")
val driversLicense: SyncResponseJson.Cipher.DriversLicense?,
@SerialName("passport")
val passport: SyncResponseJson.Cipher.Passport?,
@SerialName("folderId")
val folderId: String?,

View File

@@ -39,6 +39,24 @@ enum class CipherTypeJson {
*/
@SerialName("5")
SSH_KEY,
/**
* A bank account.
*/
@SerialName("6")
BANK_ACCOUNT,
/**
* A driver's license.
*/
@SerialName("7")
DRIVERS_LICENSE,
/**
* A passport.
*/
@SerialName("8")
PASSPORT,
}
@Keep

View File

@@ -177,6 +177,204 @@ enum class LinkedIdTypeJson(val value: UInt) {
@SerialName("418")
IDENTITY_FULL_NAME(value = 418U),
// endregion IDENTITY
// region BANK_ACCOUNT
/**
* The field is linked to the bank account's bank name.
*/
@SerialName("600")
BANK_ACCOUNT_BANK_NAME(value = 600U),
/**
* The field is linked to the bank account's name on account.
*/
@SerialName("601")
BANK_ACCOUNT_NAME_ON_ACCOUNT(value = 601U),
/**
* The field is linked to the bank account's account type.
*/
@SerialName("602")
BANK_ACCOUNT_ACCOUNT_TYPE(value = 602U),
/**
* The field is linked to the bank account's account number.
*/
@SerialName("603")
BANK_ACCOUNT_ACCOUNT_NUMBER(value = 603U),
/**
* The field is linked to the bank account's routing number.
*/
@SerialName("604")
BANK_ACCOUNT_ROUTING_NUMBER(value = 604U),
/**
* The field is linked to the bank account's branch number.
*/
@SerialName("605")
BANK_ACCOUNT_BRANCH_NUMBER(value = 605U),
/**
* The field is linked to the bank account's PIN.
*/
@SerialName("606")
BANK_ACCOUNT_PIN(value = 606U),
/**
* The field is linked to the bank account's SWIFT code.
*/
@SerialName("607")
BANK_ACCOUNT_SWIFT_CODE(value = 607U),
/**
* The field is linked to the bank account's IBAN.
*/
@SerialName("608")
BANK_ACCOUNT_IBAN(value = 608U),
/**
* The field is linked to the bank account's contact phone.
*/
@SerialName("609")
BANK_ACCOUNT_BANK_CONTACT_PHONE(value = 609U),
// endregion BANK_ACCOUNT
// region DRIVERS_LICENSE
/**
* The field is linked to the driver's license first name.
*/
@SerialName("700")
DRIVERS_LICENSE_FIRST_NAME(value = 700U),
/**
* The field is linked to the driver's license middle name.
*/
@SerialName("701")
DRIVERS_LICENSE_MIDDLE_NAME(value = 701U),
/**
* The field is linked to the driver's license last name.
*/
@SerialName("702")
DRIVERS_LICENSE_LAST_NAME(value = 702U),
/**
* The field is linked to the driver's license number.
*/
@SerialName("703")
DRIVERS_LICENSE_LICENSE_NUMBER(value = 703U),
/**
* The field is linked to the driver's license issuing country.
*/
@SerialName("704")
DRIVERS_LICENSE_ISSUING_COUNTRY(value = 704U),
/**
* The field is linked to the driver's license issuing state.
*/
@SerialName("705")
DRIVERS_LICENSE_ISSUING_STATE(value = 705U),
/**
* The field is linked to the driver's license expiration month.
*/
@SerialName("706")
DRIVERS_LICENSE_EXPIRATION_MONTH(value = 706U),
/**
* The field is linked to the driver's license expiration year.
*/
@SerialName("707")
DRIVERS_LICENSE_EXPIRATION_YEAR(value = 707U),
/**
* The field is linked to the driver's license class.
*/
@SerialName("708")
DRIVERS_LICENSE_LICENSE_CLASS(value = 708U),
// endregion DRIVERS_LICENSE
// region PASSPORT
/**
* The field is linked to the passport surname.
*/
@SerialName("800")
PASSPORT_SURNAME(value = 800U),
/**
* The field is linked to the passport given name.
*/
@SerialName("801")
PASSPORT_GIVEN_NAME(value = 801U),
/**
* The field is linked to the passport date of birth month.
*/
@SerialName("802")
PASSPORT_DOB_MONTH(value = 802U),
/**
* The field is linked to the passport date of birth year.
*/
@SerialName("803")
PASSPORT_DOB_YEAR(value = 803U),
/**
* The field is linked to the passport nationality.
*/
@SerialName("804")
PASSPORT_NATIONALITY(value = 804U),
/**
* The field is linked to the passport number.
*/
@SerialName("805")
PASSPORT_PASSPORT_NUMBER(value = 805U),
/**
* The field is linked to the passport type.
*/
@SerialName("806")
PASSPORT_PASSPORT_TYPE(value = 806U),
/**
* The field is linked to the passport issuing country.
*/
@SerialName("807")
PASSPORT_ISSUING_COUNTRY(value = 807U),
/**
* The field is linked to the passport issuing authority.
*/
@SerialName("808")
PASSPORT_ISSUING_AUTHORITY(value = 808U),
/**
* The field is linked to the passport issue month.
*/
@SerialName("809")
PASSPORT_ISSUE_MONTH(value = 809U),
/**
* The field is linked to the passport issue year.
*/
@SerialName("810")
PASSPORT_ISSUE_YEAR(value = 810U),
/**
* The field is linked to the passport expiration month.
*/
@SerialName("811")
PASSPORT_EXPIRATION_MONTH(value = 811U),
/**
* The field is linked to the passport expiration year.
*/
@SerialName("812")
PASSPORT_EXPIRATION_YEAR(value = 812U),
// endregion PASSPORT
}
@Keep

View File

@@ -516,6 +516,15 @@ data class SyncResponseJson(
@SerialName("sshKey")
val sshKey: SshKey?,
@SerialName("bankAccount")
val bankAccount: BankAccount?,
@SerialName("driversLicense")
val driversLicense: DriversLicense?,
@SerialName("passport")
val passport: Passport?,
@SerialName("collectionIds")
val collectionIds: List<String>?,
@@ -788,6 +797,171 @@ data class SyncResponseJson(
val keyFingerprint: String,
)
/**
* Represents a bank account in the vault response.
*
* @property bankName The name of the bank (nullable).
* @property nameOnAccount The name on the account (nullable).
* @property accountType The type of bank account (nullable).
* @property accountNumber The account number (nullable).
* @property routingNumber The routing/transit number (nullable).
* @property branchNumber The branch/institution number (nullable).
* @property pin The PIN (nullable).
* @property swiftCode The SWIFT code (nullable).
* @property iban The IBAN (nullable).
* @property bankContactPhone The bank contact phone number (nullable).
*/
@Serializable
data class BankAccount(
@SerialName("bankName")
val bankName: String?,
@SerialName("nameOnAccount")
val nameOnAccount: String?,
@SerialName("accountType")
val accountType: String?,
@SerialName("accountNumber")
val accountNumber: String?,
@SerialName("routingNumber")
val routingNumber: String?,
@SerialName("branchNumber")
val branchNumber: String?,
@SerialName("pin")
val pin: String?,
@SerialName("swiftCode")
val swiftCode: String?,
@SerialName("iban")
val iban: String?,
@SerialName("bankContactPhone")
val bankContactPhone: String?,
)
/**
* Represents a driver's license in the vault response.
*
* @property firstName The first name (nullable).
* @property middleName The middle name (nullable).
* @property lastName The last name (nullable).
* @property licenseNumber The license number (nullable).
* @property issuingCountry The issuing country (nullable).
* @property issuingState The issuing state/province (nullable).
* @property expirationMonth The expiration month (nullable).
* @property expirationDay The expiration day of month (nullable).
* @property expirationYear The expiration year (nullable).
* @property licenseClass The license class (nullable).
*/
@Serializable
data class DriversLicense(
@SerialName("firstName")
val firstName: String?,
@SerialName("middleName")
val middleName: String?,
@SerialName("lastName")
val lastName: String?,
@SerialName("licenseNumber")
val licenseNumber: String?,
@SerialName("issuingCountry")
val issuingCountry: String?,
@SerialName("issuingState")
val issuingState: String?,
@SerialName("expirationMonth")
val expirationMonth: String?,
@SerialName("expirationDay")
val expirationDay: String?,
@SerialName("expirationYear")
val expirationYear: String?,
@SerialName("licenseClass")
val licenseClass: String?,
)
/**
* Represents a passport in the vault response.
*
* @property surname The surname (nullable).
* @property givenName The given name (nullable).
* @property dobMonth The month of birth (nullable).
* @property dobDay The day of month of birth (nullable).
* @property dobYear The year of birth (nullable).
* @property nationality The nationality (nullable).
* @property passportNumber The passport number (nullable).
* @property passportType The passport type (nullable).
* @property issuingCountry The issuing country (nullable).
* @property issuingAuthority The issuing authority/office (nullable).
* @property issueMonth The issue month (nullable).
* @property issueDay The issue day of month (nullable).
* @property issueYear The issue year (nullable).
* @property expirationMonth The expiration month (nullable).
* @property expirationDay The expiration day of month (nullable).
* @property expirationYear The expiration year (nullable).
*/
@Serializable
data class Passport(
@SerialName("surname")
val surname: String?,
@SerialName("givenName")
val givenName: String?,
@SerialName("dobMonth")
val dobMonth: String?,
@SerialName("dobDay")
val dobDay: String?,
@SerialName("dobYear")
val dobYear: String?,
@SerialName("nationality")
val nationality: String?,
@SerialName("passportNumber")
val passportNumber: String?,
@SerialName("passportType")
val passportType: String?,
@SerialName("issuingCountry")
val issuingCountry: String?,
@SerialName("issuingAuthority")
val issuingAuthority: String?,
@SerialName("issueMonth")
val issueMonth: String?,
@SerialName("issueDay")
val issueDay: String?,
@SerialName("issueYear")
val issueYear: String?,
@SerialName("expirationMonth")
val expirationMonth: String?,
@SerialName("expirationDay")
val expirationDay: String?,
@SerialName("expirationYear")
val expirationYear: String?,
)
/**
* Represents password history in the vault response.
*

View File

@@ -629,6 +629,18 @@ private const val CREATE_ATTACHMENT_SUCCESS_JSON = """
"privateKey": "mockPrivateKey-1",
"keyFingerprint": "mockKeyFingerprint-1"
},
"bankAccount": {
"bankName": "mockBankName-1",
"nameOnAccount": "mockNameOnAccount-1",
"accountType": "mockAccountType-1",
"accountNumber": "mockAccountNumber-1",
"routingNumber": "mockRoutingNumber-1",
"branchNumber": "mockBranchNumber-1",
"pin": "mockPin-1",
"swiftCode": "mockSwiftCode-1",
"iban": "mockIban-1",
"bankContactPhone": "mockBankContactPhone-1"
},
"encryptedFor": "mockEncryptedFor-1",
"archivedDate": "2023-10-27T12:00:00.00Z"
}
@@ -758,6 +770,18 @@ private const val CREATE_RESTORE_UPDATE_CIPHER_SUCCESS_JSON = """
"privateKey": "mockPrivateKey-1",
"keyFingerprint": "mockKeyFingerprint-1"
},
"bankAccount": {
"bankName": "mockBankName-1",
"nameOnAccount": "mockNameOnAccount-1",
"accountType": "mockAccountType-1",
"accountNumber": "mockAccountNumber-1",
"routingNumber": "mockRoutingNumber-1",
"branchNumber": "mockBranchNumber-1",
"pin": "mockPin-1",
"swiftCode": "mockSwiftCode-1",
"iban": "mockIban-1",
"bankContactPhone": "mockBankContactPhone-1"
},
"encryptedFor": "mockEncryptedFor-1",
"archivedDate": "2023-10-27T12:00:00.00Z"
}

View File

@@ -335,6 +335,18 @@ private const val SYNC_SUCCESS_JSON = """
"privateKey": "mockPrivateKey-1",
"keyFingerprint": "mockKeyFingerprint-1"
},
"bankAccount": {
"bankName": "mockBankName-1",
"nameOnAccount": "mockNameOnAccount-1",
"accountType": "mockAccountType-1",
"accountNumber": "mockAccountNumber-1",
"routingNumber": "mockRoutingNumber-1",
"branchNumber": "mockBranchNumber-1",
"pin": "mockPin-1",
"swiftCode": "mockSwiftCode-1",
"iban": "mockIban-1",
"bankContactPhone": "mockBankContactPhone-1"
},
"encryptedFor": "mockEncryptedFor-1",
"archivedDate": "2023-10-27T12:00:00.00Z"
}

View File

@@ -19,6 +19,9 @@ fun createMockCipherJsonRequest(
login: SyncResponseJson.Cipher.Login? = createMockLogin(number = number),
card: SyncResponseJson.Cipher.Card? = createMockCard(number = number),
sshKey: SyncResponseJson.Cipher.SshKey? = createMockSshKey(number = number),
bankAccount: SyncResponseJson.Cipher.BankAccount? = createMockBankAccount(number = number),
driversLicense: SyncResponseJson.Cipher.DriversLicense? = null,
passport: SyncResponseJson.Cipher.Passport? = null,
identity: SyncResponseJson.Cipher.Identity? = createMockIdentity(number = number),
secureNote: SyncResponseJson.Cipher.SecureNote? = createMockSecureNote(),
fields: List<SyncResponseJson.Cipher.Field>? = listOf(createMockField(number = number)),
@@ -42,6 +45,9 @@ fun createMockCipherJsonRequest(
login = login,
card = card,
sshKey = sshKey,
bankAccount = bankAccount,
driversLicense = driversLicense,
passport = passport,
identity = identity,
secureNote = secureNote,
fields = fields,

View File

@@ -32,6 +32,9 @@ fun createMockCipher(
card: SyncResponseJson.Cipher.Card? = createMockCard(number = number),
identity: SyncResponseJson.Cipher.Identity? = createMockIdentity(number = number),
sshKey: SyncResponseJson.Cipher.SshKey? = createMockSshKey(number = number),
bankAccount: SyncResponseJson.Cipher.BankAccount? = createMockBankAccount(number = number),
driversLicense: SyncResponseJson.Cipher.DriversLicense? = null,
passport: SyncResponseJson.Cipher.Passport? = null,
secureNote: SyncResponseJson.Cipher.SecureNote? = createMockSecureNote(),
fields: List<SyncResponseJson.Cipher.Field>? = listOf(createMockField(number = number)),
isFavorite: Boolean = false,
@@ -59,6 +62,9 @@ fun createMockCipher(
identity = identity,
secureNote = secureNote,
sshKey = sshKey,
bankAccount = bankAccount,
driversLicense = driversLicense,
passport = passport,
creationDate = creationDate,
revisionDate = revisionDate,
deletedDate = deletedDate,
@@ -257,6 +263,105 @@ fun createMockSshKey(
keyFingerprint = keyFingerprint,
)
/**
* Create a mock [SyncResponseJson.Cipher.BankAccount] with a given [number].
*/
fun createMockBankAccount(
number: Int,
bankName: String? = "mockBankName-$number",
nameOnAccount: String? = "mockNameOnAccount-$number",
accountType: String? = "mockAccountType-$number",
accountNumber: String? = "mockAccountNumber-$number",
routingNumber: String? = "mockRoutingNumber-$number",
branchNumber: String? = "mockBranchNumber-$number",
pin: String? = "mockPin-$number",
swiftCode: String? = "mockSwiftCode-$number",
iban: String? = "mockIban-$number",
bankContactPhone: String? = "mockBankContactPhone-$number",
): SyncResponseJson.Cipher.BankAccount =
SyncResponseJson.Cipher.BankAccount(
bankName = bankName,
nameOnAccount = nameOnAccount,
accountType = accountType,
accountNumber = accountNumber,
routingNumber = routingNumber,
branchNumber = branchNumber,
pin = pin,
swiftCode = swiftCode,
iban = iban,
bankContactPhone = bankContactPhone,
)
/**
* Create a mock [SyncResponseJson.Cipher.DriversLicense] with a given [number].
*/
fun createMockDriversLicense(
number: Int,
firstName: String? = "mockFirstName-$number",
middleName: String? = "mockMiddleName-$number",
lastName: String? = "mockLastName-$number",
licenseNumber: String? = "mockLicenseNumber-$number",
issuingCountry: String? = "mockIssuingCountry-$number",
issuingState: String? = "mockIssuingState-$number",
expirationMonth: String? = "mockExpirationMonth-$number",
expirationDay: String? = "mockExpirationDay-$number",
expirationYear: String? = "mockExpirationYear-$number",
licenseClass: String? = "mockLicenseClass-$number",
): SyncResponseJson.Cipher.DriversLicense =
SyncResponseJson.Cipher.DriversLicense(
firstName = firstName,
middleName = middleName,
lastName = lastName,
licenseNumber = licenseNumber,
issuingCountry = issuingCountry,
issuingState = issuingState,
expirationMonth = expirationMonth,
expirationDay = expirationDay,
expirationYear = expirationYear,
licenseClass = licenseClass,
)
/**
* Create a mock [SyncResponseJson.Cipher.Passport] with a given [number].
*/
fun createMockPassport(
number: Int,
surname: String? = "mockSurname-$number",
givenName: String? = "mockGivenName-$number",
dobMonth: String? = "mockDobMonth-$number",
dobDay: String? = "mockDobDay-$number",
dobYear: String? = "mockDobYear-$number",
nationality: String? = "mockNationality-$number",
passportNumber: String? = "mockPassportNumber-$number",
passportType: String? = "mockPassportType-$number",
issuingCountry: String? = "mockIssuingCountry-$number",
issuingAuthority: String? = "mockIssuingAuthority-$number",
issueMonth: String? = "mockIssueMonth-$number",
issueDay: String? = "mockIssueDay-$number",
issueYear: String? = "mockIssueYear-$number",
expirationMonth: String? = "mockExpirationMonth-$number",
expirationDay: String? = "mockExpirationDay-$number",
expirationYear: String? = "mockExpirationYear-$number",
): SyncResponseJson.Cipher.Passport =
SyncResponseJson.Cipher.Passport(
surname = surname,
givenName = givenName,
dobMonth = dobMonth,
dobDay = dobDay,
dobYear = dobYear,
nationality = nationality,
passportNumber = passportNumber,
passportType = passportType,
issuingCountry = issuingCountry,
issuingAuthority = issuingAuthority,
issueMonth = issueMonth,
issueDay = issueDay,
issueYear = issueYear,
expirationMonth = expirationMonth,
expirationDay = expirationDay,
expirationYear = expirationYear,
)
/**
* Create a mock [SyncResponseJson.Cipher.Fido2Credential] with a given [number].
*/