Skip to content

Commit 7675aab

Browse files
author
Vyacheslav
authored
Merge pull request hyperledger-indy#930 from e-nem-y/master
Fix how `storage_credentials` parameter is passed
2 parents d06db54 + ce5fcdb commit 7675aab

File tree

4 files changed

+65
-66
lines changed

4 files changed

+65
-66
lines changed

libindy/include/indy_wallet.h

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -48,101 +48,100 @@ extern "C" {
4848

4949
indy_error_t (*openFn)(const char* name,
5050
const char* config,
51-
const char* runtime_config,
5251
const char* credentials,
5352
indy_handle_t* handle),
5453

5554
indy_error_t (*closeFn)(indy_handle_t handle),
5655

5756
indy_error_t (*deleteFn)(const char* name,
58-
const char* config,
59-
const char* credentials),
57+
const char* config,
58+
const char* credentials),
6059

6160
indy_error_t (*addRecordFn)(indy_handle_t handle,
62-
const char* type_,
63-
const char* id,
64-
const indy_u8_t * value,
65-
indy_u32_t value_len,
66-
const char* tags_json),
61+
const char* type_,
62+
const char* id,
63+
const indy_u8_t * value,
64+
indy_u32_t value_len,
65+
const char* tags_json),
6766

6867
indy_error_t (*updateRecordValueFn)(indy_handle_t handle,
69-
const char* type_,
70-
const char* id,
71-
const indy_u8_t * value,
72-
indy_u32_t value_len),
68+
const char* type_,
69+
const char* id,
70+
const indy_u8_t * value,
71+
indy_u32_t value_len),
7372

7473
indy_error_t (*updateRecordTagsFn)(indy_handle_t handle,
75-
const char* type_,
76-
const char* id,
77-
const char* tags_json),
74+
const char* type_,
75+
const char* id,
76+
const char* tags_json),
7877

7978
indy_error_t (*addRecordTagsFn)(indy_handle_t handle,
80-
const char* type_,
81-
const char* id,
82-
const char* tags_json),
79+
const char* type_,
80+
const char* id,
81+
const char* tags_json),
8382

8483
indy_error_t (*deleteRecordTagsFn)(indy_handle_t handle,
85-
const char* type_,
86-
const char* id,
87-
const char* tags_names),
84+
const char* type_,
85+
const char* id,
86+
const char* tags_names),
8887

8988
indy_error_t (*deleteRecordFn)(indy_handle_t handle,
90-
const char* type_,
91-
const char* id),
89+
const char* type_,
90+
const char* id),
9291

9392
indy_error_t (*getRecordFn)(indy_handle_t handle,
94-
const char* type_,
95-
const char* id,
96-
const char* options_json,
97-
int32_t* record_handle),
93+
const char* type_,
94+
const char* id,
95+
const char* options_json,
96+
int32_t* record_handle),
9897

9998
indy_error_t (*getRecordIdFn)(indy_handle_t handle,
100-
indy_handle_t record_handle,
101-
char* id),
99+
indy_handle_t record_handle,
100+
char* id),
102101

103102
indy_error_t (*getRecordValueFn)(indy_handle_t handle,
104-
indy_handle_t record_handle,
105-
indy_u8_t * value,
106-
indy_u32_t value_len),
103+
indy_handle_t record_handle,
104+
indy_u8_t * value,
105+
indy_u32_t value_len),
107106

108107
indy_error_t (*getRecordTagsFn)(indy_handle_t handle,
109-
indy_handle_t record_handle,
110-
char* tags_json),
108+
indy_handle_t record_handle,
109+
char* tags_json),
111110

112111
indy_error_t (*freeRecordFn)(indy_handle_t handle,
113-
indy_handle_t record_handle),
112+
indy_handle_t record_handle),
114113

115114
indy_error_t (*getStorageMetadataFn)(indy_handle_t handle,
116-
char* metadata,
117-
indy_handle_t metadata_handle),
115+
char* metadata,
116+
indy_handle_t metadata_handle),
118117

119118
indy_error_t (*setStorageMetadataFn)(indy_handle_t handle,
120-
const char* metadata),
119+
const char* metadata),
121120

122121
indy_error_t (*freeStorageMetadataFn)(indy_handle_t handle,
123-
indy_handle_t metadata_handle),
122+
indy_handle_t metadata_handle),
124123

125124
indy_error_t (*openSearchFn)(indy_handle_t handle,
126-
const char* type_,
127-
const char* query,
128-
const char* options,
129-
int32_t* search_handle),
125+
const char* type_,
126+
const char* query,
127+
const char* options,
128+
int32_t* search_handle),
130129

131130
indy_error_t (*openSearchAllFn)(indy_handle_t handle,
132-
indy_handle_t search_handle),
131+
indy_handle_t search_handle),
133132

134133
indy_error_t (*getSearchTotalCountFn)(indy_handle_t handle,
135-
indy_handle_t search_handle,
136-
indy_u32_t* total_count),
134+
indy_handle_t search_handle,
135+
indy_u32_t* total_count),
137136

138137
indy_error_t (*fetchSearchNextRecordsFn)(indy_handle_t handle,
139-
indy_handle_t search_handle,
140-
indy_handle_t record_handle),
138+
indy_handle_t search_handle,
139+
indy_handle_t record_handle),
141140

142141
indy_error_t (*freeSearchFn)(indy_handle_t handle,
143-
indy_handle_t search_handle),
142+
indy_handle_t search_handle),
144143

145-
void (*fn)(indy_handle_t xcommand_handle, indy_error_t err)
144+
void (*fn)(indy_handle_t xcommand_handle, indy_error_t err)
146145
);
147146

148147
/// Create a new secure wallet.

libindy/src/api/wallet.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ pub extern fn indy_register_wallet_storage(command_handle: i32,
151151
/// Custom storage types can be registered with indy_register_wallet_storage call.
152152
/// "storage_config": optional<object>, Storage configuration json. Storage type defines set of supported keys.
153153
/// Can be optional if storage supports default configuration.
154-
// For 'default' storage type configuration is:
154+
/// For 'default' storage type configuration is:
155155
/// {
156156
/// "path": optional<string>, Path to the directory with wallet files.
157157
/// Defaults to $HOME/.indy_client/wallets.
@@ -163,7 +163,7 @@ pub extern fn indy_register_wallet_storage(command_handle: i32,
163163
/// "key": string, Passphrase used to derive wallet master key
164164
/// "storage_credentials": optional<object> Credentials for wallet storage. Storage type defines set of supported keys.
165165
/// Can be optional if storage supports default configuration.
166-
// For 'default' storage type should be empty.
166+
/// For 'default' storage type should be empty.
167167
///
168168
/// }
169169
///
@@ -219,7 +219,7 @@ pub extern fn indy_create_wallet(command_handle: i32,
219219
/// Custom storage types can be registered with indy_register_wallet_storage call.
220220
/// "storage_config": optional<object>, Storage configuration json. Storage type defines set of supported keys.
221221
/// Can be optional if storage supports default configuration.
222-
// For 'default' storage type configuration is:
222+
/// For 'default' storage type configuration is:
223223
/// {
224224
/// "path": optional<string>, Path to the directory with wallet files.
225225
/// Defaults to $HOME/.indy_client/wallets.
@@ -234,7 +234,7 @@ pub extern fn indy_create_wallet(command_handle: i32,
234234
/// derived from this passphrase.
235235
/// "storage_credentials": optional<object> Credentials for wallet storage. Storage type defines set of supported keys.
236236
/// Can be optional if storage supports default configuration.
237-
// For 'default' storage type should be empty.
237+
/// For 'default' storage type should be empty.
238238
///
239239
/// }
240240
///
@@ -288,7 +288,7 @@ pub extern fn indy_open_wallet(command_handle: i32,
288288
/// wallet_handle: wallet handle returned by indy_open_wallet
289289
/// export_config: JSON containing settings for input operation.
290290
/// {
291-
/// "path": <strinng>, Path of the file that contains exported wallet content
291+
/// "path": <string>, Path of the file that contains exported wallet content
292292
/// "key": <string>, Passphrase used to derive export key
293293
/// }
294294
///
@@ -345,7 +345,7 @@ pub extern fn indy_export_wallet(command_handle: i32,
345345
/// Custom storage types can be registered with indy_register_wallet_storage call.
346346
/// "storage_config": optional<object>, Storage configuration json. Storage type defines set of supported keys.
347347
/// Can be optional if storage supports default configuration.
348-
// For 'default' storage type configuration is:
348+
/// For 'default' storage type configuration is:
349349
/// {
350350
/// "path": optional<string>, Path to the directory with wallet files.
351351
/// Defaults to $HOME/.indy_client/wallets.
@@ -357,7 +357,7 @@ pub extern fn indy_export_wallet(command_handle: i32,
357357
/// "key": string, Passphrase used to derive wallet master key
358358
/// "storage_credentials": optional<object> Credentials for wallet storage. Storage type defines set of supported keys.
359359
/// Can be optional if storage supports default configuration.
360-
// For 'default' storage type should be empty.
360+
/// For 'default' storage type should be empty.
361361
///
362362
/// }
363363
/// import_config: Import settings json.
@@ -458,7 +458,7 @@ pub extern fn indy_close_wallet(command_handle: i32,
458458
/// Custom storage types can be registered with indy_register_wallet_storage call.
459459
/// "storage_config": optional<object>, Storage configuration json. Storage type defines set of supported keys.
460460
/// Can be optional if storage supports default configuration.
461-
// For 'default' storage type configuration is:
461+
/// For 'default' storage type configuration is:
462462
/// {
463463
/// "path": optional<string>, Path to the directory with wallet files.
464464
/// Defaults to $HOME/.indy_client/wallets.
@@ -470,7 +470,7 @@ pub extern fn indy_close_wallet(command_handle: i32,
470470
/// "key": string, Passphrase used to derive wallet master key
471471
/// "storage_credentials": optional<object> Credentials for wallet storage. Storage type defines set of supported keys.
472472
/// Can be optional if storage supports default configuration.
473-
// For 'default' storage type should be empty.
473+
/// For 'default' storage type should be empty.
474474
///
475475
/// }
476476
///
@@ -487,13 +487,13 @@ pub extern fn indy_delete_wallet(command_handle: i32,
487487
cb: Option<extern fn(xcommand_handle: i32,
488488
err: ErrorCode)>) -> ErrorCode {
489489
trace!("indy_delete_wallet: >>> command_handle: {:?}, config: {:?}, credentials: {:?}, cb: {:?}",
490-
command_handle, config, credentials, cb);
490+
command_handle, config, "_" /*credentials*/, cb); // TODO: FIXME: log secrets in debug
491491

492492
check_useful_c_str!(config, ErrorCode::CommonInvalidParam2);
493493
check_useful_c_str!(credentials, ErrorCode::CommonInvalidParam3);
494494
check_useful_c_callback!(cb, ErrorCode::CommonInvalidParam4);
495495

496-
trace!("indy_delete_wallet: params config: {:?}, credentials: {:?}", config, credentials);
496+
trace!("indy_delete_wallet: params config: {:?}, credentials: {:?}", config, "_" /*credentials*/); // TODO: FIXME: log secrets in debug
497497

498498
let result = CommandExecutor::instance()
499499
.send(Command::Wallet(WalletCommand::Delete(

libindy/src/commands/wallet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl WalletCommandExecutor {
188188
fn _delete(&self,
189189
config: &str,
190190
credentials: &str) -> Result<()> {
191-
trace!("_delete >>> config: {:?}, credentials: {:?}", config, credentials);
191+
trace!("_delete >>> config: {:?}, credentials: {:?}", config, "_"); // TODO: FIXME: Log secrets in debug
192192

193193
let res = self.wallet_service.delete_wallet(config, credentials)?;
194194

0 commit comments

Comments
 (0)