1
1
use bitwarden_crypto:: generate_random_bytes;
2
- use chrono:: Utc ;
3
2
use credential_exchange_types:: {
4
3
format:: {
5
- Account as CxpAccount , BasicAuthCredential , Credential , EditableField , FieldType , Header ,
6
- Item , ItemType ,
4
+ Account as CxpAccount , BasicAuthCredential , Credential , EditableField , FieldType , Item ,
5
+ ItemType ,
7
6
} ,
8
7
B64Url ,
9
8
} ;
@@ -25,23 +24,18 @@ pub struct Account {
25
24
pub ( crate ) fn build_cxf ( account : Account , ciphers : Vec < Cipher > ) -> Result < String , CxpError > {
26
25
let items: Vec < Item > = ciphers. into_iter ( ) . map ( |cipher| cipher. into ( ) ) . collect ( ) ;
27
26
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 ,
42
36
} ;
43
37
44
- Ok ( serde_json:: to_string ( & header ) ?)
38
+ Ok ( serde_json:: to_string ( & account ) ?)
45
39
}
46
40
47
41
impl From < Cipher > for Item {
0 commit comments