@@ -2,59 +2,42 @@ use super::ErrorCode;
22
33use libc:: c_char;
44use std:: ffi:: CString ;
5- use std:: ptr:: null;
65
76pub struct Wallet { }
87
98impl Wallet {
10- pub fn create_wallet ( pool_name : & str , wallet_name : & str , xtype : Option < & str > , config : Option < & str > , credentials : & str ) -> Result < ( ) , ErrorCode > {
9+ pub fn create_wallet ( config : & str , credentials : & str ) -> Result < ( ) , ErrorCode > {
1110 let ( receiver, command_handle, cb) = super :: callbacks:: _closure_to_cb_ec ( ) ;
1211
13- let pool_name = CString :: new ( pool_name) . unwrap ( ) ;
14- let wallet_name = CString :: new ( wallet_name) . unwrap ( ) ;
15- let xtype_str = xtype. map ( |s| CString :: new ( s) . unwrap ( ) ) . unwrap_or ( CString :: new ( "" ) . unwrap ( ) ) ;
16- let config_str = config. map ( |s| CString :: new ( s) . unwrap ( ) ) . unwrap_or ( CString :: new ( "" ) . unwrap ( ) ) ;
12+ let config = CString :: new ( config) . unwrap ( ) ;
1713 let credentials = CString :: new ( credentials) . unwrap ( ) ;
1814
1915 let err = unsafe {
2016 indy_create_wallet ( command_handle,
21- pool_name. as_ptr ( ) ,
22- wallet_name. as_ptr ( ) ,
23- if xtype. is_some ( ) { xtype_str. as_ptr ( ) } else { null ( ) } ,
24- if config. is_some ( ) { config_str. as_ptr ( ) } else { null ( ) } ,
17+ config. as_ptr ( ) ,
2518 credentials. as_ptr ( ) ,
2619 cb)
2720 } ;
2821
2922 super :: results:: result_to_empty ( err, receiver)
3023 }
3124
32- pub fn open_wallet ( wallet_name : & str , config : Option < & str > , credentials : & str ) -> Result < i32 , ErrorCode > {
25+ pub fn open_wallet ( config : & str , credentials : & str ) -> Result < i32 , ErrorCode > {
3326 let ( receiver, command_handle, cb) = super :: callbacks:: _closure_to_cb_ec_i32 ( ) ;
3427
35- let wallet_name = CString :: new ( wallet_name) . unwrap ( ) ;
36- let config_str = config. map ( |s| CString :: new ( s) . unwrap ( ) ) . unwrap_or ( CString :: new ( "" ) . unwrap ( ) ) ;
28+ let config = CString :: new ( config) . unwrap ( ) ;
3729 let credentials = CString :: new ( credentials) . unwrap ( ) ;
3830
3931 let err = unsafe {
4032 indy_open_wallet ( command_handle,
41- wallet_name. as_ptr ( ) ,
42- if config. is_some ( ) { config_str. as_ptr ( ) } else { null ( ) } ,
33+ config. as_ptr ( ) ,
4334 credentials. as_ptr ( ) ,
4435 cb)
4536 } ;
4637
4738 super :: results:: result_to_int ( err, receiver)
4839 }
4940
50- pub fn list_wallets ( ) -> Result < String , ErrorCode > {
51- let ( receiver, command_handle, cb) = super :: callbacks:: _closure_to_cb_ec_string ( ) ;
52-
53- let err = unsafe { indy_list_wallets ( command_handle, cb) } ;
54-
55- super :: results:: result_to_string ( err, receiver)
56- }
57-
5841 pub fn delete_wallet ( wallet_name : & str , credentials : & str ) -> Result < ( ) , ErrorCode > {
5942 let ( receiver, command_handle, cb) = super :: callbacks:: _closure_to_cb_ec ( ) ;
6043
@@ -95,22 +78,16 @@ impl Wallet {
9578 super :: results:: result_to_empty ( err, receiver)
9679 }
9780
98- pub fn import_wallet ( pool_name : & str , wallet_name : & str , xtype : Option < & str > , config : Option < & str > , credentials : & str , import_config_json : & str ) -> Result < ( ) , ErrorCode > {
81+ pub fn import_wallet ( config : & str , credentials : & str , import_config_json : & str ) -> Result < ( ) , ErrorCode > {
9982 let ( receiver, command_handle, cb) = super :: callbacks:: _closure_to_cb_ec ( ) ;
10083
101- let pool_name = CString :: new ( pool_name) . unwrap ( ) ;
102- let wallet_name = CString :: new ( wallet_name) . unwrap ( ) ;
103- let xtype_str = xtype. map ( |s| CString :: new ( s) . unwrap ( ) ) . unwrap_or ( CString :: new ( "" ) . unwrap ( ) ) ;
104- let config_str = config. map ( |s| CString :: new ( s) . unwrap ( ) ) . unwrap_or ( CString :: new ( "" ) . unwrap ( ) ) ;
84+ let config = CString :: new ( config) . unwrap ( ) ;
10585 let credentials = CString :: new ( credentials) . unwrap ( ) ;
10686 let import_config_json = CString :: new ( import_config_json) . unwrap ( ) ;
10787
10888 let err = unsafe {
10989 indy_import_wallet ( command_handle,
110- pool_name. as_ptr ( ) ,
111- wallet_name. as_ptr ( ) ,
112- if xtype. is_some ( ) { xtype_str. as_ptr ( ) } else { null ( ) } ,
113- if config. is_some ( ) { config_str. as_ptr ( ) } else { null ( ) } ,
90+ config. as_ptr ( ) ,
11491 credentials. as_ptr ( ) ,
11592 import_config_json. as_ptr ( ) ,
11693 cb)
@@ -123,33 +100,24 @@ impl Wallet {
123100extern {
124101 #[ no_mangle]
125102 fn indy_create_wallet ( command_handle : i32 ,
126- pool_name : * const c_char ,
127- name : * const c_char ,
128- xtype : * const c_char ,
129103 config : * const c_char ,
130104 credentials : * const c_char ,
131105 cb : Option < extern fn ( xcommand_handle : i32 , err : ErrorCode ) > ) -> ErrorCode ;
132106
133107 #[ no_mangle]
134108 fn indy_open_wallet ( command_handle : i32 ,
135- name : * const c_char ,
136- runtime_config : * const c_char ,
109+ config : * const c_char ,
137110 credentials : * const c_char ,
138111 cb : Option < extern fn ( xcommand_handle : i32 , err : ErrorCode , handle : i32 ) > ) -> ErrorCode ;
139112
140- #[ no_mangle]
141- fn indy_list_wallets ( command_handle : i32 ,
142- cb : Option < extern fn ( xcommand_handle : i32 , err : ErrorCode ,
143- wallets : * const c_char ) > ) -> ErrorCode ;
144-
145113 #[ no_mangle]
146114 fn indy_close_wallet ( command_handle : i32 ,
147115 handle : i32 ,
148116 cb : Option < extern fn ( xcommand_handle : i32 , err : ErrorCode ) > ) -> ErrorCode ;
149117
150118 #[ no_mangle]
151119 fn indy_delete_wallet ( command_handle : i32 ,
152- name : * const c_char ,
120+ config : * const c_char ,
153121 credentials : * const c_char ,
154122 cb : Option < extern fn ( xcommand_handle : i32 , err : ErrorCode ) > ) -> ErrorCode ;
155123
@@ -162,9 +130,6 @@ extern {
162130
163131 #[ no_mangle]
164132 fn indy_import_wallet ( command_handle : i32 ,
165- pool_name : * const c_char ,
166- name : * const c_char ,
167- storage_type : * const c_char ,
168133 config : * const c_char ,
169134 credentials : * const c_char ,
170135 import_config_json : * const c_char ,
0 commit comments