Skip to content

Commit 4bea0f5

Browse files
authored
Merge branch 'master' into py-tutorial3
2 parents 384cb02 + ff227b6 commit 4bea0f5

File tree

163 files changed

+11452
-9727
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+11452
-9727
lines changed

ci/indy-pool.dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ RUN pip3 install -U \
1919
setuptools
2020

2121
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
22-
ARG indy_stream=master
22+
ARG indy_stream=stable
2323
RUN echo "deb https://repo.sovrin.org/deb xenial $indy_stream" >> /etc/apt/sources.list
2424

2525
RUN useradd -ms /bin/bash -u $uid indy
2626

27-
ARG indy_plenum_ver=1.4.419
28-
ARG indy_anoncreds_ver=1.0.32
29-
ARG indy_node_ver=1.4.480
27+
ARG indy_plenum_ver=1.4.45
28+
ARG indy_anoncreds_ver=1.0.11
29+
ARG indy_node_ver=1.4.66
3030
ARG python3_indy_crypto_ver=0.4.1
3131
ARG indy_crypto_ver=0.4.0
3232

cli/src/commands/ledger.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ pub mod get_validator_info_command {
357357
};
358358

359359
for (node, response) in responses {
360+
if response.eq("timeout") {
361+
println_err!("Restart pool node {} timeout.", node);
362+
continue
363+
}
360364
let response = serde_json::from_str::<Response<serde_json::Value>>(&response)
361365
.map_err(|err| println_err!("Invalid data has been received: {:?}", err))?;
362366
println_succ!("Get validator info response for node {}:", node);
@@ -687,6 +691,11 @@ pub mod pool_restart_command {
687691
};
688692

689693
for (node, response) in responses {
694+
if response.eq("timeout") {
695+
println_err!("Restart pool node {} timeout.", node);
696+
continue
697+
}
698+
690699
let response = serde_json::from_str::<Response<serde_json::Value>>(&response)
691700
.map_err(|err| println_err!("Invalid data has been received: {:?}", err))?;
692701

cli/src/commands/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ pub fn get_object_param<'a>(name: &'a str, params: &'a CommandParams) -> Result<
117117
}
118118
}
119119

120+
pub fn get_opt_object_param<'a>(name: &'a str, params: &'a CommandParams) -> Result<Option<serde_json::Value>, ()> {
121+
match params.get(name) {
122+
Some(_) => Ok(Some(get_object_param(name, params)?)),
123+
None => Ok(None)
124+
}
125+
}
126+
120127
fn extract_array_tuples<'a>(param: &'a str) -> Vec<String> {
121128
let re = Regex::new(r#"\(([^\(\)]+)\),?"#).unwrap();
122129
re.captures_iter(param).map(|c| c[1].to_string()).collect::<Vec<String>>()

cli/src/commands/wallet.rs

Lines changed: 232 additions & 85 deletions
Large diffs are not rendered by default.

cli/src/libindy/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ pub enum ErrorCode
171171

172172
// Insufficient funds on inputs
173173
PaymentInsufficientFundsError = 702,
174+
175+
// No such source on a ledger
176+
PaymentSourceDoesNotExistError = 703
174177
}
175178

176179
impl ErrorCode {
@@ -229,6 +232,7 @@ impl ErrorCode {
229232
PaymentUnknownMethodError => "Unknown payment method was given",
230233
PaymentIncompatibleMethodsError => "Multiple different payment methods were specified",
231234
PaymentInsufficientFundsError => "Insufficient funds on inputs",
235+
PaymentSourceDoesNotExistError => "No such source found",
232236
}
233237
}
234238
}

cli/src/libindy/wallet.rs

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,42 @@ use super::ErrorCode;
22

33
use libc::c_char;
44
use std::ffi::CString;
5-
use std::ptr::null;
65

76
pub struct Wallet {}
87

98
impl 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 {
123100
extern {
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,

doc/design/001-cli/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ indy> wallet <command>
127127
#### Wallet create
128128
Create new wallet with specified name and pool:
129129
```
130-
indy> wallet create <wallet name> pool_name=<pool name> key=<key>
130+
indy> wallet create <wallet name> key=<key> [storage_type=<storage_type>] [storage_config={config json}]
131131
```
132132
TODO: Think about custom wallet types support. Now we force default wallet security model..
133133

@@ -166,7 +166,7 @@ indy> wallet export export_path=<path-to-file> export_key=[<export key>]
166166
Create new wallet and then import content from the specified file.
167167

168168
```indy-cli
169-
indy> wallet import <wallet name> pool_name=<pool name> key=<key> export_path=<path-to-file> export_key=<key used for export>
169+
indy> wallet import <wallet name> key=<key> export_path=<path-to-file> export_key=<key used for export> [storage_type=<storage_type>] [storage_config=<key1:value1,key2:value2>]
170170
171171
172172
### Pool management commands

doc/getting-started/getting-started.dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ RUN pip3 install -U \
2020
pip \
2121
setuptools \
2222
jupyter \
23-
python3-indy==1.4.0-dev-586
23+
python3-indy==1.5.0
2424

2525
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88 \
26-
&& add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial master" \
26+
&& add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial stable" \
2727
&& apt-get update \
2828
&& apt-get install -y \
29-
libindy
29+
libindy=1.5.0
3030

3131
USER indy
3232

libindy/Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libindy/Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ path = "src/lib.rs"
2020
crate-type = ["staticlib","rlib", "cdylib"]
2121

2222
[features]
23-
default = ["bn_openssl", "box_sodium", "sealedbox_sodium", "base58_rust_base58", "xsalsa20_sodium", "chacha20poly1305_ietf_sodium", "pair_amcl", "hash_openssl", "local_nodes_pool", "revocation_tests", "pwhash_argon2i13_sodium", "hmacsha256_sodium"]
23+
default = ["bn_openssl", "box_sodium", "sealedbox_sodium", "base58_rust_base58", "base64_rust_base64", "xsalsa20_sodium", "chacha20poly1305_ietf_sodium", "pair_amcl", "hash_openssl", "local_nodes_pool", "revocation_tests", "pwhash_argon2i13_sodium", "hmacsha256_sodium", "memzero_sodium"]
2424
bn_openssl = ["openssl", "int_traits"]
2525
box_sodium = ["sodiumoxide"]
2626
sealedbox_sodium = ["sodiumoxide"]
2727
base58_rust_base58 = ["rust-base58"]
28+
base64_rust_base64 = ["base64"]
2829
xsalsa20_sodium = ["sodiumoxide"]
2930
chacha20poly1305_ietf_sodium = ["sodiumoxide"]
3031
pwhash_argon2i13_sodium = ["sodiumoxide"]
@@ -34,12 +35,13 @@ local_nodes_pool = []
3435
revocation_tests = []
3536
sodium_static = []
3637
hmacsha256_sodium = ["sodiumoxide"]
38+
memzero_sodium = ["sodiumoxide"]
3739

3840
# Causes the build to fail on all warnings
3941
fatal_warnings = []
4042

4143
[dependencies]
42-
indy-crypto = { version = "=0.4.1", optional = true }
44+
indy-crypto = { version = "=0.4.1-dev-50", optional = true }
4345
int_traits = { version = "0.1.1", optional = true }
4446
digest = "0.6.2"
4547
env_logger = "0.5.10"
@@ -55,7 +57,7 @@ rand = "0.3"
5557
rusqlite = "0.13.0" # Make sure rusqlite for android is also bumped with this. Rusqlite for android is at the bottom of this document.
5658
libsqlite3-sys = "0.9.1"
5759
rust-base58 = {version = "0.0.4", optional = true}
58-
base64 = "0.6.0"
60+
base64 = {version = "0.6.0", optional = true}
5961
serde = "1.0"
6062
serde_json = "1.0"
6163
serde_derive = "1.0"

0 commit comments

Comments
 (0)