bitwarden_data/
lib.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
4#[serde(rename_all = "camelCase")]
5pub struct Export {
6    pub encrypted: bool,
7    pub collections: Vec<Collection>,
8    pub items: Vec<Item>,
9}
10
11#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
12#[serde(rename_all = "camelCase")]
13pub struct Collection {
14    pub id: String,
15    pub organization_id: Option<String>,
16    pub name: String,
17    pub external_id: Option<String>,
18}
19
20#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
21#[serde(rename_all = "camelCase")]
22pub struct PasswordHistory {
23    pub last_used_date: String,
24    pub password: String,
25}
26
27#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
28#[serde(rename_all = "camelCase")]
29pub struct CustomField {
30    pub name: String,
31    pub value: String,
32    #[serde(rename = "type")]
33    pub type_field: i64,
34    pub linked_id: Option<String>,
35}
36
37#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
38#[serde(rename_all = "camelCase")]
39pub struct Item {
40    pub password_history: Option<Vec<PasswordHistory>>,
41    pub revision_date: String,
42    pub creation_date: String,
43    pub deleted_date: Option<String>,
44    pub id: String,
45    pub organization_id: Option<String>,
46    pub folder_id: Option<String>,
47    #[serde(rename = "type")]
48    pub type_field: i64,
49    pub reprompt: i64,
50    pub name: String,
51    pub notes: String,
52    pub favorite: bool,
53    pub secure_note: Option<SecureNote>,
54    pub collection_ids: Vec<String>,
55    pub identity: Option<Identity>,
56    pub card: Option<Card>,
57    pub login: Option<Login>,
58    #[serde(default)]
59    pub fields: Vec<CustomField>,
60}
61
62#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
63#[serde(rename_all = "camelCase")]
64pub struct SecureNote {
65    #[serde(rename = "type")]
66    pub type_field: i64,
67}
68
69#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
70#[serde(rename_all = "camelCase")]
71pub struct Identity {
72    pub title: Option<String>,
73    pub first_name: Option<String>,
74    pub middle_name: Option<String>,
75    pub last_name: Option<String>,
76    pub address1: Option<String>,
77    pub address2: Option<String>,
78    pub address3: Option<String>,
79    pub city: Option<String>,
80    pub state: Option<String>,
81    pub postal_code: Option<String>,
82    pub country: Option<String>,
83    pub company: Option<String>,
84    pub email: Option<String>,
85    pub phone: Option<String>,
86    pub ssn: Option<String>,
87    pub username: Option<String>,
88    pub passport_number: Option<String>,
89    pub license_number: Option<String>,
90}
91
92#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
93#[serde(rename_all = "camelCase")]
94pub struct Card {
95    pub cardholder_name: Option<String>,
96    pub brand: Option<String>,
97    pub number: Option<String>,
98    pub exp_month: Option<String>,
99    pub exp_year: Option<String>,
100    pub code: Option<String>,
101}
102
103#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
104#[serde(rename_all = "camelCase")]
105pub struct Login {
106    #[serde(default)]
107    pub uris: Vec<Uri>,
108    pub username: Option<String>,
109    pub password: Option<String>,
110    pub totp: Option<String>,
111}
112
113#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
114#[serde(rename_all = "camelCase")]
115pub struct Uri {
116    #[serde(rename = "match")]
117    pub match_field: Option<String>,
118    pub uri: String,
119}
120
121#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
122#[serde(rename_all = "camelCase")]
123pub struct Field {
124    pub name: String,
125    pub value: String,
126    #[serde(rename = "type")]
127    pub type_field: i64,
128    pub linked_id: Option<String>,
129}