Skip to content

Commit c6d6f10

Browse files
committed
Return account directly
1 parent 8afb57d commit c6d6f10

File tree

1 file changed

+12
-18
lines changed
  • crates/bitwarden-exporters/src/cxp

1 file changed

+12
-18
lines changed

crates/bitwarden-exporters/src/cxp/mod.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use bitwarden_crypto::generate_random_bytes;
2-
use chrono::Utc;
32
use credential_exchange_types::{
43
format::{
5-
Account as CxpAccount, BasicAuthCredential, Credential, EditableField, FieldType, Header,
6-
Item, ItemType,
4+
Account as CxpAccount, BasicAuthCredential, Credential, EditableField, FieldType, Item,
5+
ItemType,
76
},
87
B64Url,
98
};
@@ -25,23 +24,18 @@ pub struct Account {
2524
pub(crate) fn build_cxf(account: Account, ciphers: Vec<Cipher>) -> Result<String, CxpError> {
2625
let items: Vec<Item> = ciphers.into_iter().map(|cipher| cipher.into()).collect();
2726

28-
let header = Header {
29-
version: 0,
30-
exporter: "Bitwarden".to_string(),
31-
timestamp: Utc::now().timestamp() as u64,
32-
accounts: vec![CxpAccount {
33-
id: account.id.as_bytes().as_slice().into(),
34-
user_name: "".to_owned(),
35-
email: account.email,
36-
full_name: account.name,
37-
icon: None,
38-
collections: vec![],
39-
items,
40-
extensions: None,
41-
}],
27+
let account = CxpAccount {
28+
id: account.id.as_bytes().as_slice().into(),
29+
user_name: "".to_owned(),
30+
email: account.email,
31+
full_name: account.name,
32+
icon: None,
33+
collections: vec![],
34+
items,
35+
extensions: None,
4236
};
4337

44-
Ok(serde_json::to_string(&header)?)
38+
Ok(serde_json::to_string(&account)?)
4539
}
4640

4741
impl From<Cipher> for Item {

0 commit comments

Comments
 (0)